summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJosh Blum2012-11-28 21:37:33 -0800
committerJosh Blum2012-11-28 21:37:33 -0800
commitfdce6faa0c4b7a1dc1fa42b2ce15dd8aa2c0c8b7 (patch)
treeca49ec1a065356387d49286eb51eaf669474ce07 /lib
parent7fe33bd6aba762549d05ace9f66d5cf29530aa76 (diff)
downloadsandhi-fdce6faa0c4b7a1dc1fa42b2ce15dd8aa2c0c8b7.tar.gz
sandhi-fdce6faa0c4b7a1dc1fa42b2ce15dd8aa2c0c8b7.tar.bz2
sandhi-fdce6faa0c4b7a1dc1fa42b2ce15dd8aa2c0c8b7.zip
larger theron msg pool and print on exit only
Diffstat (limited to 'lib')
-rw-r--r--lib/theron_allocator.cpp18
1 files changed, 16 insertions, 2 deletions
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 <boost/circular_buffer.hpp>
#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();