PUMA Library Reference Manual
|
#include <Puma/ConstSizeMemPool.h>
Constant size memory block pool.
Memory blocks are not freed before the pool is destroyed. Free blocks are inserted into a free list for reuse.
Following global functions are defined that use a constant size memory pool:
N | Number of bytes for each memory block to allocate. |
Public Member Functions | |
ConstSizeMemPool () | |
Construct an empty memory pool. | |
~ConstSizeMemPool () | |
Destroy the memory pool. | |
void * | alloc () |
Get a block of memory. | |
void | free (void *block) |
Insert a block of memory into the free list for reuse. | |
void | clean () |
Free all allocated memory blocks. | |
Static Public Member Functions | |
static ConstSizeMemPool & | inst () |
Get the memory pool for this block size. | |
|
inline |
Construct an empty memory pool.
|
inline |
Destroy the memory pool.
Frees all memory blocks allocated.
|
inline |
Get a block of memory.
If no free block is available, a new block of memory is allocated.
|
inline |
Free all allocated memory blocks.
|
inline |
Insert a block of memory into the free list for reuse.
The memory block is freed when the pool is destroyed.
block | Pointer to the memory block. |
|
inlinestatic |
Get the memory pool for this block size.
There is only one memory pool for each block size.