summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-06-14 18:59:47 +0200
committerTycho <work.tycho+git@gmail.com>2014-06-14 18:59:47 +0200
commitbff76f201ffec0cc4c4df2be6ac125efa985dce7 (patch)
treef722467975cbabe9c62b6f9466027ba0c61f1235
parentFixed comments (diff)
downloadcuberite-bff76f201ffec0cc4c4df2be6ac125efa985dce7.tar
cuberite-bff76f201ffec0cc4c4df2be6ac125efa985dce7.tar.gz
cuberite-bff76f201ffec0cc4c4df2be6ac125efa985dce7.tar.bz2
cuberite-bff76f201ffec0cc4c4df2be6ac125efa985dce7.tar.lz
cuberite-bff76f201ffec0cc4c4df2be6ac125efa985dce7.tar.xz
cuberite-bff76f201ffec0cc4c4df2be6ac125efa985dce7.tar.zst
cuberite-bff76f201ffec0cc4c4df2be6ac125efa985dce7.zip
Diffstat (limited to '')
-rw-r--r--src/AllocationPool.h10
1 files changed, 10 insertions, 0 deletions
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<cStarvationCallbacks> 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()