Block allocator.
More...
#include <BlockAllocator.hpp>
Block allocator.
This is a small object allocator used for allocating small objects that persist for more than one time step.
- Note
- This data structure is 136-bytes large (on at least one 64-bit platform).
- See also
- http://www.codeproject.com/useritems/Small_Block_Allocator.asp
◆ size_type
◆ BlockAllocator()
| BlockAllocator::BlockAllocator |
( |
| ) |
|
◆ ~BlockAllocator()
| BlockAllocator::~BlockAllocator |
( |
| ) |
|
|
noexcept |
◆ Allocate()
| void * BlockAllocator::Allocate |
( |
size_type |
n | ) |
|
Allocates memory.
Allocates uninitialized storage. Uses alloc if the size is larger than MaxBlockSize. Otherwise looks for an appropriately sized block from the free list. Failing that, alloc is used to grow the free list from which memory is returned.
- See also
- alloc.
◆ AllocateArray()
template<typename T >
| T* box2d::BlockAllocator::AllocateArray |
( |
size_type |
n | ) |
|
|
inline |
◆ Clear()
| void BlockAllocator::Clear |
( |
| ) |
|
Clears this allocator.
- Note
- This resets the chunk-count back to zero.
◆ Free()
| void BlockAllocator::Free |
( |
void * |
p, |
|
|
size_type |
n |
|
) |
| |
Free memory.
This will use free if the size is larger than MaxBlockSize.
◆ GetChunkCount()
| auto box2d::BlockAllocator::GetChunkCount |
( |
| ) |
const |
|
inlinenoexcept |
◆ BlockSizes
| constexpr auto box2d::BlockAllocator::BlockSizes = size_type{14} |
|
static |
◆ ChunkArrayIncrement
| constexpr auto box2d::BlockAllocator::ChunkArrayIncrement = size_type{128} |
|
static |
◆ ChunkSize
| constexpr auto box2d::BlockAllocator::ChunkSize = size_type{16 * 1024} |
|
static |
◆ MaxBlockSize
| constexpr auto box2d::BlockAllocator::MaxBlockSize = size_type{640} |
|
static |
Max block size (before using external allocator).
The documentation for this class was generated from the following files: