||11 months ago|
|include||1 year ago|
|src||1 year ago|
|test||1 year ago|
|CMakeLists.txt||11 months ago|
|README.md||1 year ago|
A memory pool implementation.
Each block in the pool is tagged with a boolean value that indicates whether the block is free or in use. The allocator otherwise maintains little additional information. Therefore, some operations have linear-time complexity. Specifically:
- Allocating a block scans the pool for the next free block in linear time.
- Freeing a block runs in constant time.
- Iterating over the pool's used blocks is linear over the number of blocks in the pool, as opposed to just the number of used blocks.
The allocator's internal data is also stored separately from the main array of blocks so that the block data remains tightly packed.
For convenience of programming and debugging, free blocks in the mempool always remain zeroed out. If your data structures are valid when zeroed out, then you do not need to explicitly initialize them.