![]() |
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Allocates memory storing unused elements in a linked list. More...
#include <AllocationPool.h>
Public Member Functions | |
virtual T * | Allocate () override |
Allocates a pointer to T. More... | |
cListAllocationPool (std::unique_ptr< typename cAllocationPool< T >::cStarvationCallbacks > a_Callbacks, size_t a_MinElementsInReserve, size_t a_MaxElementsInReserve) | |
virtual void | Free (T *a_ptr) override |
Frees the pointer passed in a_ptr, invalidating it. More... | |
virtual | ~cListAllocationPool () override |
![]() | |
bool | IsEqual (const cAllocationPool &a_Other) const NOEXCEPT |
Two pools compare equal if memory allocated by one can be freed by the other. More... | |
virtual | ~cAllocationPool () |
Private Member Functions | |
virtual bool | DoIsEqual (const cAllocationPool< T > &a_Other) const NOEXCEPT override |
Private Attributes | |
std::unique_ptr< typename cAllocationPool< T >::cStarvationCallbacks > | m_Callbacks |
std::list< void * > | m_FreeList |
size_t | m_MaxElementsInReserve |
Maximum free list size before returning memory to the OS. More... | |
size_t | m_MinElementsInReserve |
The minimum number of elements to keep in the free list before malloc fails. More... | |
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.
Definition at line 63 of file AllocationPool.h.
|
inline |
Definition at line 68 of file AllocationPool.h.
|
inlineoverridevirtual |
Definition at line 86 of file AllocationPool.h.
|
inlineoverridevirtual |
Allocates a pointer to T.
Implements cAllocationPool< T >.
Definition at line 96 of file AllocationPool.h.
|
inlineoverrideprivatevirtual |
Implements cAllocationPool< T >.
Definition at line 179 of file AllocationPool.h.
|
inlineoverridevirtual |
Frees the pointer passed in a_ptr, invalidating it.
Implements cAllocationPool< T >.
Definition at line 149 of file AllocationPool.h.
|
private |
Definition at line 177 of file AllocationPool.h.
|
private |
Definition at line 176 of file AllocationPool.h.
|
private |
Maximum free list size before returning memory to the OS.
Definition at line 175 of file AllocationPool.h.
|
private |
The minimum number of elements to keep in the free list before malloc fails.
Definition at line 173 of file AllocationPool.h.