From bff76f201ffec0cc4c4df2be6ac125efa985dce7 Mon Sep 17 00:00:00 2001 From: Tycho Date: Sat, 14 Jun 2014 17:59:47 +0100 Subject: [PATCH] Fill with buffer on startup --- src/AllocationPool.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/AllocationPool.h b/src/AllocationPool.h index b8862e7df..e4f1427f6 100644 --- a/src/AllocationPool.h +++ b/src/AllocationPool.h @@ -19,6 +19,16 @@ class cAllocationPool { cAllocationPool(std::auto_ptr a_Callbacks) : m_Callbacks(a_Callbacks) { + for(int i = 0; i < NumElementsInReserve; i++) + { + void * space = malloc(sizeof(T)); + if (space == NULL) + { + m_Callbacks->OnStartingUsingBuffer(); + break; + } + m_FreeList.push_front(space); + } } ~cAllocationPool()