build correctly without DO_MEMORY_USAGE

This commit is contained in:
David Rose 2011-12-21 02:31:37 +00:00
parent 9326f5be54
commit f6a32897ba
2 changed files with 36 additions and 36 deletions

View File

@ -336,12 +336,39 @@
#define ALIGN_16BYTE
#endif
// Do we need to implement memory-alignment enforcement within the
// MemoryHook class, or will the underlying malloc implementation
// provide it automatically?
#if !defined(LINMATH_ALIGN)
// We don't actually require any special memory-alignment beyond what
// the underlying implementation is likely to provide anyway.
#undef MEMORY_HOOK_DO_ALIGN
#elif defined(USE_MEMORY_DLMALLOC)
// This specialized malloc implementation can perform the required
// alignment.
#undef MEMORY_HOOK_DO_ALIGN
#elif defined(USE_MEMORY_PTMALLOC2)
// But not this one. For some reason it crashes when we try to build
// it with alignment 16. So if we're using ptmalloc2, we need to
// enforce alignment externally.
#define MEMORY_HOOK_DO_ALIGN 1
#elif defined(IS_OSX) || defined(_WIN64)
// The OS-provided malloc implementation will do the required
// alignment.
#undef MEMORY_HOOK_DO_ALIGN
#else
// Whoops, we need memory alignment, and we have to provide it ourselves.
#define MEMORY_HOOK_DO_ALIGN 1
#endif
/* Determine our memory-allocation requirements. */
#if defined(USE_MEMORY_PTMALLOC2) || defined(USE_MEMORY_DLMALLOC) || defined(DO_MEMORY_USAGE)
/* If we are using our own alternative malloc, or if we're building
with DO_MEMORY_USAGE in effect, it follows we need to use our
custom STL allocator. */
#define USE_STL_ALLOCATOR 1
#if defined(USE_MEMORY_PTMALLOC2) || defined(USE_MEMORY_DLMALLOC) || defined(DO_MEMORY_USAGE) || defined(MEMORY_HOOK_DO_ALIGN)
/* In this case we have some custom memory management requirements. */
#else
/* Otherwise, if we have no custom memory management needs at all, we
might as well turn it all off and go straight to the OS-level
@ -349,6 +376,10 @@
#define USE_MEMORY_NOWRAPPERS 1
#endif
/* We must always use the STL allocator nowadays, because we have
redefined the constructors for pvector, pmap, etc. */
#define USE_STL_ALLOCATOR 1
/*
We define the macros BEGIN_PUBLISH and END_PUBLISH to bracket
functions and global variable definitions that are to be published

View File

@ -23,37 +23,6 @@
class DeletedBufferChain;
// Do we need to implement memory-alignment enforcement within the
// MemoryHook class, or will the underlying malloc implementation
// provide it automatically?
#if !defined(LINMATH_ALIGN)
// We don't actually require any special memory-alignment beyond what
// the underlying implementation is likely to provide anyway.
#undef MEMORY_HOOK_DO_ALIGN
#elif defined(USE_MEMORY_DLMALLOC)
// This specialized malloc implementation can perform the required
// alignment.
#undef MEMORY_HOOK_DO_ALIGN
#elif defined(USE_MEMORY_PTMALLOC2)
// But not this one. For some reason it crashes when we try to build
// it with alignment 16. So if we're using ptmalloc2, we need to
// enforce alignment externally.
#define MEMORY_HOOK_DO_ALIGN 1
#elif defined(IS_OSX) || defined(_WIN64)
// The OS-provided malloc implementation will do the required
// alignment.
#undef MEMORY_HOOK_DO_ALIGN
#else
// Whoops, we need memory alignment, and we have to provide it ourselves.
#define MEMORY_HOOK_DO_ALIGN 1
#endif
////////////////////////////////////////////////////////////////////
// Class : MemoryHook
// Description : This class provides a wrapper around the various