From fdce6faa0c4b7a1dc1fa42b2ce15dd8aa2c0c8b7 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 28 Nov 2012 21:37:33 -0800 Subject: larger theron msg pool and print on exit only --- lib/theron_allocator.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/theron_allocator.cpp b/lib/theron_allocator.cpp index 1054ee9..aa856a4 100644 --- a/lib/theron_allocator.cpp +++ b/lib/theron_allocator.cpp @@ -16,7 +16,21 @@ #include #define MY_ALLOCATOR_CHUNK_SIZE 256 -#define MY_ALLOCATOR_POOL_SIZE (MY_ALLOCATOR_CHUNK_SIZE * (1 << 16)) +#define MY_ALLOCATOR_POOL_SIZE (MY_ALLOCATOR_CHUNK_SIZE * (1 << 18)) + +static unsigned long long unwanted_malloc_count = 0; + +static struct ExitPrinter +{ + ExitPrinter(void){} + ~ExitPrinter(void) + { + if (unwanted_malloc_count) + { + VAR(unwanted_malloc_count); + } + } +} exit_printer; static struct WorkerAllocator : Theron::IAllocator { @@ -45,8 +59,8 @@ static struct WorkerAllocator : Theron::IAllocator mSpinLock.Lock(); if (queue.empty()) { + unwanted_malloc_count++; mSpinLock.Unlock(); - std::cout << "~" << std::flush; return std::malloc(size); } void *memory = queue.front(); -- cgit