diff options
Diffstat (limited to 'src/base/fast_alloc.hh')
-rw-r--r-- | src/base/fast_alloc.hh | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/base/fast_alloc.hh b/src/base/fast_alloc.hh index 3e22e59c1..50b761c9c 100644 --- a/src/base/fast_alloc.hh +++ b/src/base/fast_alloc.hh @@ -62,15 +62,9 @@ // collapse the destructor call chain back up the inheritance // hierarchy. -// Uncomment this #define to track in-use objects -// (for debugging memory leaks). -//#define FAST_ALLOC_DEBUG - -// Uncomment this #define to count news, deletes, and chunk allocations -// (by bucket). -// #define FAST_ALLOC_STATS - #include "config/no_fast_alloc.hh" +#include "config/fast_alloc_debug.hh" +#include "config/fast_alloc_stats.hh" #if NO_FAST_ALLOC @@ -88,7 +82,7 @@ class FastAlloc { void *operator new(size_t); void operator delete(void *, size_t); -#ifdef FAST_ALLOC_DEBUG +#if FAST_ALLOC_DEBUG FastAlloc(); FastAlloc(FastAlloc*,FastAlloc*); // for inUseHead, see below virtual ~FastAlloc(); @@ -121,13 +115,13 @@ class FastAlloc { static void *freeLists[Num_Buckets]; -#ifdef FAST_ALLOC_STATS +#if FAST_ALLOC_STATS static unsigned newCount[Num_Buckets]; static unsigned deleteCount[Num_Buckets]; static unsigned allocCount[Num_Buckets]; #endif -#ifdef FAST_ALLOC_DEBUG +#if FAST_ALLOC_DEBUG // per-object debugging fields bool inUse; // in-use flag FastAlloc *inUsePrev; // ptrs to build list of in-use objects @@ -170,7 +164,7 @@ void *FastAlloc::allocate(size_t sz) else p = moreStructs(b); -#ifdef FAST_ALLOC_STATS +#if FAST_ALLOC_STATS ++newCount[b]; #endif @@ -192,7 +186,7 @@ void FastAlloc::deallocate(void *p, size_t sz) b = bucketFor(sz); *(void **)p = freeLists[b]; freeLists[b] = p; -#ifdef FAST_ALLOC_STATS +#if FAST_ALLOC_STATS ++deleteCount[b]; #endif } |