WPILibC++ 2025.1.1
|
A BlockAllocator adapter that tracks another allocator using a tracker. More...
#include <wpi/memory/tracking.hpp>
Public Types | |
using | allocator_type = make_block_allocator_t<BlockOrRawAllocator> |
using | tracker = Tracker |
Public 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 |
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.
using wpi::memory::tracked_block_allocator< Tracker, BlockOrRawAllocator >::allocator_type = make_block_allocator_t<BlockOrRawAllocator> |
using wpi::memory::tracked_block_allocator< Tracker, BlockOrRawAllocator >::tracker = Tracker |
|
inlineexplicitnoexcept |
|
inlinenoexcept |
|
inline |
block_size
and args
.
|
inline |
Tracker::on_allocator_growth()
after forwarding to the allocator.
|
inlinenoexcept |
Tracker::on_allocator_shrinking()
and forwards to the allocator.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |