class
PoolAlloc
template<int ElemSize, int ElemsPerBlock = 512, int Alignment = 4, bool Lock = false>A memory allocator that allocates elements of the same size.
Allows for fairly quick allocations and deallocations.
Template parameters
ElemSize | Size of a single element in the pool. This will be the exact allocation size. 4 byte minimum. |
|---|---|
ElemsPerBlock | Determines how much space to reserve for elements. This determines the initial size of the pool, and the additional size the pool will be expanded by every time the number of elements goes over the available storage limit. |
Alignment | Memory alignment of each allocated element. Note that alignments that are larger than element size, or aren't a multiplier of element size will introduce additionally padding for each element, and therefore require more internal memory. |
Lock | If true the pool allocator will be made thread safe (at the cost of performance). |
Public
Constructors
PoolAlloc<ElemSize, ElemsPerBlock, Alignment, Lock>
Methods
~PoolAlloc<ElemSize, ElemsPerBlock, Alignment, Lock>
Alloc
Allocates enough memory for a single element in the pool.
Free
Deallocates an element from the pool.