memory
|
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
.
Typedefs | |
using | allocator_type = typename traits::allocator_type |
Static Functions | |
static float | growth_factor () noexcept |
static std::size_t | grow_block_size (std::size_t block_size) noexcept |
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 |
|
explicitnoexcept |
2
. block_size
must be greater than 0. memory_block allocate_block | ( | ) |
allocate_array()
function of the RawAllocator.
|
noexcept |
block
must be previously returned by a call to allocate_block().
|
noexcept |
|
noexcept |
|
staticnoexcept |