All Classes |Grouped Classes |Index

Class CL_BlockAllocator

Memory allocator that allocates in blocks. More...

Derived from:

None

Derived by:

None

Group:

System (Core)

#include <ClanLib/core.h>

Class Members:

Construction:

CL_BlockAllocator

Block Allocator constructor.


Operations:

allocate

Allocate memory (See note on this class for the allocation method)

free

Free the allocated memory.

new_obj

Allocate a class (And call it's constructor)

delete_obj

Call the class destructor.

Detailed description:

This allocator will never free any memory until free() is called or the allocator object is destroyed. If any objects have been new'engusing CL_BlockAllocated they have to be delete'edrbefore free() is called, otherwise the destructors of the objects will not get called. Same rules apply to the new_obj and delete_obj template functions.

The allocator allocates memory from the heap in blocks. Each time the allocated block is exhausted, the allocator will double the block size and allocate more memory.