Win360::Win360MemoryPool Class Reference
#include <win360memorypool.h>
Detailed Description
A simple thread-safe memory pool. Memory pool items are 16-byte aligned.FIXME:
- debug: overwrite memory blocks with pattern
- debug: check for double-free
- debug: check for mem-leaks
- debug: list memory pools in Debug HTML page!
(C) 2009 Radon Labs GmbH
Public Member Functions | |
Win360MemoryPool () | |
constructor | |
~Win360MemoryPool () | |
destructor | |
void | Setup (Memory::HeapType heapType, uint blockSize, uint numBlocks) |
setup the memory pool | |
void * | Alloc () |
allocate a block from the pool (NOTE: returns 0 if pool exhausted!) | |
void | Free (void *ptr) |
deallocate a block from the pool | |
bool | IsPoolBlock (void *ptr) const |
return true if block is owned by this pool | |
uint | GetNumBlocks () const |
get number of allocated blocks in pool | |
uint | GetBlockSize () const |
get block size | |
uint | GetAlignedBlockSize () const |
get aligned block size | |
uint | GetPoolSize () const |
get pool size | |
Static Public Member Functions | |
static uint | ComputeAlignedBlockSize (uint blockSize) |
compute the actual block size including alignment and management data |
Member Function Documentation
void Win360::Win360MemoryPool::Setup | ( | Memory::HeapType | heapType_, | |
uint | blockSize_, | |||
uint | numBlocks_ | |||
) |
setup the memory pool
NOTE: name must be a static string!