# OpenGraph DrawingFramework

v.2012.07

memory.h File Reference

Declaration of memory manager for allocating small pieces of memory. More...

#include <stdlib.h>
#include <new>
#include <ogdf/internal/basic/PoolMemoryAllocator.h>
#include <ogdf/internal/basic/MallocMemoryAllocator.h>

Go to the source code of this file.

## Namespaces

namespace  ogdf
The namespace for all OGDF objects.

## Macros

#define OGDF_ALLOCATOR   ogdf::PoolMemoryAllocator
#define OGDF_MALLOC_NEW_DELETE   OGDF_MM(MallocMemoryAllocator)
Creates new and delete operators in a class using the malloc memory allocator.
#define OGDF_MEMORY_H
#define OGDF_MEMORY_POOL_TS
#define OGDF_MM(Alloc)
#define OGDF_NEW   new
#define OGDF_NEW_DELETE   OGDF_MM(OGDF_ALLOCATOR)
Creates new and delete operators in a class using ogdf's memory allocator.

## Detailed Description

Declaration of memory manager for allocating small pieces of memory.

This file is part of the Open Graph Drawing Framework (OGDF).
See README.txt in the root directory of the OGDF installation for details.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 2 or 3 as published by the Free Software Foundation; see the file LICENSE.txt included in the packaging of this file for details.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
http://www.gnu.org/copyleft/gpl.html

Definition in file memory.h.

## Macro Definition Documentation

 #define OGDF_ALLOCATOR   ogdf::PoolMemoryAllocator

Definition at line 111 of file memory.h.

 #define OGDF_MALLOC_NEW_DELETE   OGDF_MM(MallocMemoryAllocator)

Creates new and delete operators in a class using the malloc memory allocator.

Definition at line 118 of file memory.h.

 #define OGDF_MEMORY_H

Definition at line 50 of file memory.h.

 #define OGDF_MEMORY_POOL_TS

Definition at line 76 of file memory.h.

 #define OGDF_MM ( Alloc )
Value:
public: \
static void *operator new(size_t nBytes) { \
if(OGDF_LIKELY(Alloc::checkSize(nBytes))) \
return Alloc::allocate(nBytes); \
else \
return MallocMemoryAllocator::allocate(nBytes); \
} \
\
static void operator delete(void *p, size_t nBytes) { \
if(OGDF_LIKELY(p != 0)) { \
if(OGDF_LIKELY(Alloc::checkSize(nBytes))) \
Alloc::deallocate(nBytes, p); \
else \
MallocMemoryAllocator::deallocate(nBytes, p); \
} \
} \
static void *operator new(size_t, void *p) { return p; } \
static void operator delete(void *, void *) { }

Definition at line 85 of file memory.h.

 #define OGDF_NEW   new

Definition at line 106 of file memory.h.

 #define OGDF_NEW_DELETE   OGDF_MM(OGDF_ALLOCATOR)

Creates new and delete operators in a class using ogdf's memory allocator.

Definition at line 115 of file memory.h.