|
wavelength 1.0.0
|
A fixed-size allocator over one block of IOP memory. More...
#include <poolallocator.h>
Public Member Functions | |
| void | InitWithBlock (int elementSize, int count, void *block) |
| Carve a caller-supplied block into elements. | |
| void | Init (int elementSize, int count) |
| Allocate a block and carve it into elements, rounding the element size up to a word. | |
| void | Release () |
| Release the block Init() allocated. | |
| void * | Alloc () |
| Take an element off the free list. | |
| void | Free (void *element) |
| Return an element to the free list. | |
A fixed-size allocator over one block of IOP memory.
The class has no RTTI, and its name is inferred from its role. Free elements form a singly linked list through their first word. Elements are raw storage, and no constructor runs on them.
| void PoolAllocator::InitWithBlock | ( | int | elementSize, |
| int | count, | ||
| void * | block ) |
Carve a caller-supplied block into elements.
| elementSize | Bytes per element, at least the size of a pointer. |
| count | Number of elements. |
| block | The block, at least elementSize times count bytes. |
| void PoolAllocator::Init | ( | int | elementSize, |
| int | count ) |
Allocate a block and carve it into elements, rounding the element size up to a word.
| elementSize | Bytes per element. |
| count | Number of elements. |
| void PoolAllocator::Release | ( | ) |
Release the block Init() allocated.
| void * PoolAllocator::Alloc | ( | ) |
Take an element off the free list.
| void PoolAllocator::Free | ( | void * | element | ) |
Return an element to the free list.
| element | Storage Alloc() returned. |