summaryrefslogtreecommitdiffstats
path: root/src/AllocationPool.h
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-06-14 21:04:35 +0200
committerTycho <work.tycho+git@gmail.com>2014-06-14 21:04:35 +0200
commit2643a46c69d7d1354ec324a274dba4ccca315f3c (patch)
tree55f0643b4993dfa473ca167041c8c0ba1fc587e6 /src/AllocationPool.h
parentReformated ChunkMap.h (diff)
downloadcuberite-2643a46c69d7d1354ec324a274dba4ccca315f3c.tar
cuberite-2643a46c69d7d1354ec324a274dba4ccca315f3c.tar.gz
cuberite-2643a46c69d7d1354ec324a274dba4ccca315f3c.tar.bz2
cuberite-2643a46c69d7d1354ec324a274dba4ccca315f3c.tar.lz
cuberite-2643a46c69d7d1354ec324a274dba4ccca315f3c.tar.xz
cuberite-2643a46c69d7d1354ec324a274dba4ccca315f3c.tar.zst
cuberite-2643a46c69d7d1354ec324a274dba4ccca315f3c.zip
Diffstat (limited to '')
-rw-r--r--src/AllocationPool.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/AllocationPool.h b/src/AllocationPool.h
index 88bc132e9..cac5689b9 100644
--- a/src/AllocationPool.h
+++ b/src/AllocationPool.h
@@ -18,10 +18,15 @@ public:
virtual ~cAllocationPool() {}
+ /** Allocates a pointer to T **/
virtual T * Allocate() = 0;
+
+ /** Frees the pointer passed in a_ptr, invalidating it **/
virtual void Free(T * a_ptr) = 0;
};
+/** Allocates memory storing unused elements in a linked list. Keeps at least NumElementsInReserve
+ elements in the list unless malloc fails so that the program has a reserve to handle OOM.**/
template<class T, size_t NumElementsInReserve>
class cListAllocationPool : public cAllocationPool<T>
{