wavelength 1.0.0
Loading...
Searching...
No Matches
poolallocator.h
Go to the documentation of this file.
1#pragma once
2
4struct PoolLink {
6};
7
16public:
26 void InitWithBlock(int elementSize, int count, void *block);
27
36 void Init(int elementSize, int count);
37
44 void Release();
45
53 void *Alloc();
54
62 void Free(void *element);
63
64private:
74 void BuildFreeList(int elementSize, int count, void *block);
75
76 PoolLink *mBlock;
77 PoolLink *mFree;
78 int mElementSize;
79 int mCount;
80};
A fixed-size allocator over one block of IOP memory.
Definition poolallocator.h:15
void * Alloc()
Take an element off the free list.
void Release()
Release the block Init() allocated.
void Init(int elementSize, int count)
Allocate a block and carve it into elements, rounding the element size up to a word.
void Free(void *element)
Return an element to the free list.
void InitWithBlock(int elementSize, int count, void *block)
Carve a caller-supplied block into elements.