This class implements a simple stack-based allocation scheme. Initially you have to define its size. Each allocation will be done from this initially created pool and must be deallocated in LIFO order. All data will be released when the allocator will be released. This allocation scheme is fast and does no call any new-calls during the lifetime of the allocator pool.
More...
|
| | TStackAllocator ()=default |
| | The default class constructor.
|
| | TStackAllocator (size_t initSize) |
| | The class constructor with the initial size for the stack.
|
| | ~TStackAllocator () |
| | The class destructor.
|
| T * | alloc (size_t size) |
| | Will allocate the number of items from the stack.
|
| bool | release (T *ptr) |
| | Will release the last item from the stack.
|
| void | reserve (size_t size) |
| void | clear () |
| | Will clear the whole memory, all used data will be marked as invalid.
|
| void | reset () |
| | Will reset the allocated memory, all used data will be marked as invalid.
|
| size_t | capacity () const |
| | Returns the number of allocated instances on the stack.
|
| size_t | reservedMem () const |
| | Returns the allocated memory in bytes.
|
| size_t | freeMem () const |
| | Returns the free memory in bytes.
|
| void | dumpAllocations (std::string &allocs) |
| | Will dump a statistic overview into the given string.
|
template<class T>
class cppcore::TStackAllocator< T >
This class implements a simple stack-based allocation scheme. Initially you have to define its size. Each allocation will be done from this initially created pool and must be deallocated in LIFO order. All data will be released when the allocator will be released. This allocation scheme is fast and does no call any new-calls during the lifetime of the allocator pool.
- Template Parameters
-
Definition at line 44 of file TStackAllocator.h.