Elm
1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/alloc/BlockAllocator.h>
Public Member Functions | |
BlockAllocator (int block_size, int block_per_chunk=16) | |
void * | allocate (void) throw (BadAlloc) |
void | free (void *block) |
An allocator for fixed-size block. Initial allocation is performed quicly in a stack allocator but fried blocks are added to a free list allowing quick re-use of fried blocks.
elm::BlockAllocator::BlockAllocator | ( | int | block_size, |
int | block_per_chunk = 16 |
||
) |
Block allocator builder.
block_size | Block size in bytes. |
block_per_chunk | Number of block in each allocated chunk. |
void * elm::BlockAllocator::allocate | ( | void | ) | ||
throw | ( | BadAlloc | |||
) |
void elm::BlockAllocator::free | ( | void * | block | ) |
Free a previously allocated object.
block | Block to free. |