Osiris Framework
0.3
|
Memory pool implementation for special memory management. More...
#include <OsirisSDK/OMemoryPool.h>
Public Member Functions | |
OMemoryPool (size_t blockSize, size_t segmentSize) | |
Class constructor. More... | |
virtual | ~OMemoryPool () |
Class destructor. | |
size_t | blockSize () const |
Returns the size of the block in bytes. | |
size_t | segmentSize () const |
Returns the number of blocks in each segment. | |
size_t | availableBlocks () const |
Current available blocks. | |
size_t | segmentCount () const |
Current segment count. | |
void * | alloc (size_t sz) |
Memory allocation method that replaces to malloc(). | |
void | free (void *ptr) |
Memory release method that replaces free(). | |
void | printDebugInfo () |
Print debug information on the stderr. | |
Memory pool implementation for special memory management.
In some cases (i.e. events) objects may have to be instanced in a regular basis. In order to avoid frequent malloc() calls and memory fragmentation, we resort to a memory pool.
OMemoryPool::OMemoryPool | ( | size_t | blockSize, |
size_t | segmentSize | ||
) |
Class constructor.
blockSize | Size of each memory block in bytes. |
segmentSize | Number of blocks in a memory segment. |