WPILibC++ 2025.1.1
|
A BlockAllocator that uses a given RawAllocator for allocating the blocks. More...
#include <wpi/memory/memory_arena.hpp>
Public Types | |
using | allocator_type = typename traits::allocator_type |
Public Member Functions | |
growing_block_allocator (std::size_t block_size, allocator_type alloc=allocator_type()) noexcept | |
memory_block | allocate_block () |
void | deallocate_block (memory_block block) noexcept |
std::size_t | next_block_size () const noexcept |
allocator_type & | get_allocator () noexcept |
Static Public Member Functions | |
static float | growth_factor () noexcept |
static std::size_t | grow_block_size (std::size_t block_size) noexcept |
A BlockAllocator that uses a given RawAllocator for allocating the blocks.
It calls the allocate_array()
function with a node of size 1
and maximum alignment on the used allocator for the block allocation. The size of the next memory block will grow by a given factor after each allocation, allowing an amortized constant allocation time in the higher level allocator. The factor can be given as rational in the template parameter, default is 2
.
using wpi::memory::growing_block_allocator< RawAllocator, Num, Den >::allocator_type = typename traits::allocator_type |
|
inlineexplicitnoexcept |
2
. block_size
must be greater than 0.
|
inline |
allocate_array()
function of the RawAllocator.
|
inlinenoexcept |
block
must be previously returned by a call to allocate_block().
|
inlinenoexcept |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
inlinenoexcept |