diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-06-14 18:59:47 +0200 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-06-14 18:59:47 +0200 |
commit | bff76f201ffec0cc4c4df2be6ac125efa985dce7 (patch) | |
tree | f722467975cbabe9c62b6f9466027ba0c61f1235 /src | |
parent | Fixed comments (diff) | |
download | cuberite-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 'src')
-rw-r--r-- | src/AllocationPool.h | 10 |
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() |