Memory.h File Reference

The "take no prisoners" approach to memory allocation :). More...

#include "LDK/Types.h"
#include "LDK/Threading.h"
#include "LDK/TemplateMeta.h"
#include "LDK/Singletons.h"
#include "LDK/Exceptions.h"
#include <vector>
#include <list>
#include <string.h>
#include <assert.h>
#include "LDK/STLAllocator.h"
#include "LDK/STLMallocAllocator.h"

Include dependency graph for Memory.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  LDK
namespace  LDK::Details

Data Structures

struct  LDK::Details::Node
class  LDK::Details::Heap
class  LDK::Details::Pool
struct  LDK::Details::PoolCount< Size >
struct  LDK::Details::PoolCount< MIN_CHUNKSIZE >
struct  LDK::Details::PoolCount<(MIN_CHUNKSIZE+(MIN_CHUNKSIZE/2))>
struct  LDK::Details::PoolCount<(MIN_CHUNKSIZE+(MIN_CHUNKSIZE/3))>
struct  LDK::Details::NoOfPools
class  LDK::Details::ChunkSize< Idx >
struct  LDK::Details::ChunkSize< Idx >::MinChunkPowerOf2
struct  LDK::Details::ChunkSize< Idx >::MinChunkNotPowerOf2
class  LDK::Details::ChunkSize< NoOfPools::value >
struct  LDK::Details::ChunkSize< NoOfPools::value >::MaxChunkPowerOf2
struct  LDK::Details::ChunkSize< NoOfPools::value >::MaxChunkNotPowerOf2
struct  LDK::Details::PoolIdxSearch< NoOfPools, Size, Idx >
struct  LDK::Details::PoolIdxSearch< NoOfPools::value, Size, NoOfPools::value >
class  LDK::MetaPool
struct  LDK::CTAllocHelper< Idx >
struct  LDK::RTAllocHelper< Size >

Defines

#define BYTE_ALIGNMENT   16
#define LDK_SPARE_HEAPS   30
#define LDK_MAXCHUNKSIZE   ((LDK_HEAPSIZE_K*1024)/2)
#define MAX_CHUNKS_PER_HEAP   (LDK_HEAPSIZE_K/ LDK_MINCHUNKSIZE)
#define MIN_CHUNKSIZE   LDK_MINCHUNKSIZE
#define MAX_CHUNKSIZE   LDK_MAXCHUNKSIZE
#define LDK_CTALLOC(size)   LDK::alloc<size>(__FILE__,__LINE__)
 Allocate size bytes of memory.
#define LDK_CTTYPEALLOC(type, num)   ((type*)LDK::alloc<sizeof(type)*num)>(__FILE__,__LINE__)
 Allocate sizeof(type)*num bytes of memory.
#define LDK_RTALLOC(size)   LDK::alloc(__FILE__,__LINE__,size)
 Allocate size bytes of memory.
#define LDK_RTTYPEALLOC(type, num)   ((type*)LDK::alloc(__FILE__,__LINE__,sizeof(type)*num))
 Allocate sizeof(type)*num bytes of memory.
#define LDK_REALLOC(mem, newSize)   LDK::realloc(__FILE__,__LINE__,mem,newSize)
 re-allocate some memory using a run-time search for the best fit.
#define LDK_CREATE0(Type)   LDK::create<Type >(__FILE__,__LINE__)
 create an object that takes no constructor arguments
#define LDK_CREATE1(Type, c1)   LDK::create<Type >(__FILE__,__LINE__,c1)
 create an object that takes 1 constructor argument
#define LDK_CREATE2(Type, c1, c2)   LDK::create<Type >(__FILE__,__LINE__,c1,c2)
 create an object that takes 2 constructor arguments
#define LDK_CREATE3(Type, c1, c2, c3)   LDK::create<Type >(__FILE__,__LINE__,c1,c2,c3)
 create an object that takes 3 constructor arguments
#define LDK_CREATE4(Type, c1, c2, c3, c4)   LDK::create<Type >(__FILE__,__LINE__,c1,c2,c3,c4)
 create an object that takes 4 constructor arguments
#define LDK_CREATE5(Type, c1, c2, c3, c4, c5)   LDK::create<Type >(__FILE__,__LINE__,c1,c2,c3,c4,c5)
 create an object that takes 5 constructor arguments
#define LDK_CREATE6(Type, c1, c2, c3, c4, c5, c6)
 create an object that takes 6 constructor arguments
#define LDK_CREATE7(Type, c1, c2, c3, c4, c5, c6, c7)
 create an object that takes 7 constructor arguments
#define LDK_CREATE8(Type, c1, c2, c3, c4, c5, c6, c7, c8)
 create an object that takes 8 constructor arguments
#define LDK_CREATE9(Type, c1, c2, c3, c4, c5, c6, c7, c8, c9)
 create an object that takes 9 constructor arguments
#define LDK_CREATE10(Type, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
 create an object that takes 10 constructor arguments
#define LDK_ALLOCATORS
 Macro that expands to per-class replacement allocation operators that use the LDK system.

Typedefs

typedef Singleton< MetaPool > LDK::MemorySingleton

Functions

LDK_API void * LDK::alignedAlloc (size_t bytes, size_t align=BYTE_ALIGNMENT)
LDK_API void LDK::alignedFree (void *mem)
void * LDK::bigAlloc (size_t size)
Heap * LDK::Details::getOwnerHeap (void *mem)
Node * LDK::Details::getNode (void *mem)
template<size_t Size>
void * LDK::alloc (const char *file, int line)
void * LDK::alloc (const char *file, int line, size_t size)
void LDK::dealloc (void *mem)
 Free memory allocated with this system only.
void * LDK::realloc (const char *file, int line, void *mem, size_t newSize)
template<class T>
T * LDK::create (const char *file, int line)
template<class T, typename C1>
T * LDK::create (const char *file, int line, C1 c1)
template<class T, typename C1, typename C2>
T * LDK::create (const char *file, int line, C1 c1, C2 c2)
template<class T, typename C1, typename C2, typename C3>
T * LDK::create (const char *file, int line, C1 c1, C2 c2, C3 c3)
template<class T, typename C1, typename C2, typename C3, typename C4>
T * LDK::create (const char *file, int line, C1 c1, C2 c2, C3 c3, C4 c4)
template<class T, typename C1, typename C2, typename C3, typename C4, typename C5>
T * LDK::create (const char *file, int line, C1 c1, C2 c2, C3 c3, C4 c4, C5 c5)
template<class T, typename C1, typename C2, typename C3, typename C4, typename C5, typename C6>
T * LDK::create (const char *file, int line, C1 c1, C2 c2, C3 c3, C4 c4, C5 c5, C6 c6)
template<class T, typename C1, typename C2, typename C3, typename C4, typename C5, typename C6, typename C7>
T * LDK::create (const char *file, int line, C1 c1, C2 c2, C3 c3, C4 c4, C5 c5, C6 c6, C7 c7)
template<class T, typename C1, typename C2, typename C3, typename C4, typename C5, typename C6, typename C7, typename C8>
T * LDK::create (const char *file, int line, C1 c1, C2 c2, C3 c3, C4 c4, C5 c5, C6 c6, C7 c7, C8 c8)
template<class T, typename C1, typename C2, typename C3, typename C4, typename C5, typename C6, typename C7, typename C8, typename C9>
T * LDK::create (const char *file, int line, C1 c1, C2 c2, C3 c3, C4 c4, C5 c5, C6 c6, C7 c7, C8 c8, C9 c9)
template<class T, typename C1, typename C2, typename C3, typename C4, typename C5, typename C6, typename C7, typename C8, typename C9, typename C10>
T * LDK::create (const char *file, int line, C1 c1, C2 c2, C3 c3, C4 c4, C5 c5, C6 c6, C7 c7, C8 c8, C9 c9, C10 c10)
template<class T>
void LDK::destroy (const T *o)
 Calls an object's destructor and frees the memory.

Variables

LDK_API LDK::MetaPool
LDK_API LDK::Details::Heap
LDK_API LDK::Details::Pool


Detailed Description

Definition in file Memory.h.


Generated on Fri Aug 17 18:32:26 2007 for LDK by  doxygen 1.5.1