Osiris Framework  0.3
OMemoryPool Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

OMemoryPool::OMemoryPool ( size_t  blockSize,
size_t  segmentSize 
)

Class constructor.

Parameters
blockSizeSize of each memory block in bytes.
segmentSizeNumber of blocks in a memory segment.

The documentation for this class was generated from the following files: