template<Int BLOCK_SIZE, Bool LIFO, typename ALLOCATOR = DefaultAllocator>
class maxon::StackBufferAllocator< BLOCK_SIZE, LIFO, ALLOCATOR >
A StackBufferAllocator can be used if a large number of allocations shall be done in the sequel, and either all of those allocations will be freed together at a later point, or they will be freed in reverse order (LIFO). If all allocations will be freed together, set the LIFO template parameter to false, then there is practically no memory overhead for each allocation. For a de-allocation in reverse order, set LIFO to true. Then a structure of the size of two Ints has to be added for each allocation for bookkeeping purposes.
- Template Parameters
-
BLOCK_SIZE | Minimum size of each memory block which is obtained from ALLOCATOR. |
LIFO | Use true if you want to use this allocator in a stack-like LIFO way. This adds some overhead. If set to false, no actual de-allocation will happen until all allocations have been freed. |
ALLOCATOR | The parent allocator from which this allocator shall obtain its memory. |