|
Click
|
Template for memory pools. More...
#include <memorypool.hh>
Public Member Functions | |
| MemoryPool () | |
| Construct an empty MemoryPool. | |
| MemoryPool (unsigned int initialSize) | |
| Construct a MemoryPool. | |
| ~MemoryPool () | |
| Destruct the memory pool. | |
| void | initialize (unsigned int initialSize) |
| Initialize the MemoryPool. | |
| T * | getMemory () |
| Obtain memory from the memory pool. | |
| void | releaseMemory (T *p) |
| Release memory and put it back in the pool. | |
Template for memory pools.
This template is used to create memory pools that can be used to achieve fast memory allocation. It is not multi-thread safe, but can be duplicated per-thread iif objects are always released on the same core they were allocated.
|
inline |
Construct an empty MemoryPool.
|
inline |
Construct a MemoryPool.
| initialSize | The initial number of elements in the pool |
|
inline |
Destruct the memory pool.
|
inline |
Initialize the MemoryPool.
| initialSize | The initial number of elements in the pool |
|
inline |
Obtain memory from the memory pool.
|
inline |
Release memory and put it back in the pool.
| p | Pointer to the object of type T |