Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::BlockAllocator Class Reference

#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)
 

Detailed Description

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.

Constructor & Destructor Documentation

elm::BlockAllocator::BlockAllocator ( int  block_size,
int  block_per_chunk = 16 
)

Block allocator builder.

Parameters
block_sizeBlock size in bytes.
block_per_chunkNumber of block in each allocated chunk.

Member Function Documentation

void * elm::BlockAllocator::allocate ( void  )
throw (BadAlloc
)

Allocate an object.

Returns
Allocated object.

References elm::StackAllocator::allocate().

void elm::BlockAllocator::free ( void *  block)

Free a previously allocated object.

Parameters
blockBlock to free.

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