memory
|
A BlockAllocator adapter that tracks another allocator using a tracker.
It wraps another BlockAllocator and calls the tracker function before forwarding to it. The class can then be used anywhere a BlockAllocator is required and the memory usage will be tracked.
It will only call the on_allocator_growth()
and on_allocator_shrinking()
tracking functions, since a BlockAllocator is normally used inside higher allocators only.
Typedefs | |
using | allocator_type = make_block_allocator_t< BlockOrRawAllocator > |
using | tracker = Tracker |
Member Functions | |
template<typename... Args> | |
tracked_block_allocator (std::size_t block_size, tracker t, Args &&... args) | |
memory_block | allocate_block () |
void | deallocate_block (memory_block block) noexcept |
std::size_t | next_block_size () const noexcept |
tracked_block_allocator (tracker t={}) noexcept | |
tracked_block_allocator (tracker t, allocator_type &&alloc) noexcept | |
allocator_type & | get_allocator () noexcept |
const allocator_type & | get_allocator () const noexcept |
tracker & | get_tracker () noexcept |
const tracker & | get_tracker () const noexcept |
|
explicitnoexcept |
|
noexcept |
tracked_block_allocator | ( | std::size_t | block_size, |
tracker | t, | ||
Args &&... | args | ||
) |
block_size
and args
. memory_block allocate_block | ( | ) |
Tracker::on_allocator_growth()
after forwarding to the allocator.
|
noexcept |
Tracker::on_allocator_shrinking()
and forwards to the allocator.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |