|
wavelength 1.0.0
|
Pool of equal blocks carved from a region, each free block linking to the next. More...
#include <blockpool.h>
Classes | |
| struct | Node |
| A free block, which starts with the link to the next one. More... | |
Public Member Functions | |
| void | Init (int nBlockSize, int nNumBlocks, void *pMemory) |
| Take over a region as a chain of free blocks. | |
| void * | Alloc () |
| Hand out the first free block. | |
| void | Free (void *pBlock) |
| Return a block to the head of the chain. | |
Pool of equal blocks carved from a region, each free block linking to the next.
The class is not polymorphic. The name is inferred. The memory tracker takes its AllocInfo records from one.
| void BlockPool::Init | ( | int | nBlockSize, |
| int | nNumBlocks, | ||
| void * | pMemory ) |
Take over a region as a chain of free blocks.
| nBlockSize | The size of each block in bytes. |
| nNumBlocks | The number of blocks. |
| pMemory | The region. |
| void * BlockPool::Alloc | ( | ) |
Hand out the first free block.
| void BlockPool::Free | ( | void * | pBlock | ) |
Return a block to the head of the chain.
| pBlock | The block. |