memory
|
A stateful RawAllocator that is designed for allocations in a loop.
It uses N
stacks for the allocation, one of them is always active. Allocation uses the currently active stack. Calling iteration_allocator::next_iteration() at the end of the loop, will make the next stack active for allocation, effectively releasing all of its memory. Any memory allocated will thus be usable for N
iterations of the loop. This type of allocator is a generalization of the double frame allocator.
Typedefs | |
using | allocator_type = detail::iteration_block_allocator< BlockOrRawAllocator > |
Static Functions | |
static std::size_t | max_iterations () noexcept |
Member Functions | |
template<typename... Args> | |
iteration_allocator (std::size_t block_size, Args &&... args) | |
iteration_allocator (iteration_allocator &&other) noexcept | |
iteration_allocator & | operator= (iteration_allocator &&other) noexcept |
void * | allocate (std::size_t size, std::size_t alignment) |
void * | try_allocate (std::size_t size, std::size_t alignment) noexcept |
void | next_iteration () noexcept |
std::size_t | cur_iteration () const noexcept |
allocator_type & | get_allocator () noexcept |
std::size_t | capacity_left (std::size_t i) const noexcept |
std::size_t | capacity_left () const noexcept |
|
explicit |
void * allocate | ( | std::size_t | size, |
std::size_t | alignment | ||
) |
size
and alignment
must be valid.
|
noexcept |
nullptr
if the current stack does not have any memory left.
|
noexcept |
|
staticnoexcept |
N
.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |