WPILibC++ 2025.1.1
|
A RawAllocator adapter that tracks another allocator using a tracker. More...
#include <wpi/memory/tracking.hpp>
Public Types | |
using | allocator_type = typename allocator_traits<RawAllocator>::allocator_type |
using | tracker = Tracker |
using | is_stateful |
Public Member Functions | |
~tracked_allocator () noexcept | |
void * | allocate_node (std::size_t size, std::size_t alignment) |
void * | try_allocate_node (std::size_t size, std::size_t alignment) noexcept |
void * | allocate_array (std::size_t count, std::size_t size, std::size_t alignment) |
void * | try_allocate_array (std::size_t count, std::size_t size, std::size_t alignment) noexcept |
void | deallocate_node (void *ptr, std::size_t size, std::size_t alignment) noexcept |
bool | try_deallocate_node (void *ptr, std::size_t size, std::size_t alignment) noexcept |
void | deallocate_array (void *ptr, std::size_t count, std::size_t size, std::size_t alignment) noexcept |
bool | try_deallocate_array (void *ptr, std::size_t count, std::size_t size, std::size_t alignment) noexcept |
tracked_allocator (tracker t={}) noexcept | |
tracked_allocator (tracker t, allocator_type &&allocator) noexcept | |
tracked_allocator (tracked_allocator &&other) noexcept | |
tracked_allocator & | operator= (tracked_allocator &&other) noexcept |
std::size_t | max_node_size () const |
std::size_t | max_array_size () const |
std::size_t | max_alignment () const |
allocator_type & | get_allocator () noexcept |
const allocator_type & | get_allocator () const noexcept |
tracker & | get_tracker () noexcept |
const tracker & | get_tracker () const noexcept |
Related Symbols | |
(Note that these are not member symbols.) | |
template<class Tracker , class RawAllocator > | |
auto | make_tracked_allocator (Tracker t, RawAllocator &&alloc) -> tracked_allocator< Tracker, typename std::decay< RawAllocator >::type > |
A RawAllocator adapter that tracks another allocator using a tracker.
It wraps another RawAllocator and calls the tracker function before forwarding to it. The class can then be used anywhere a RawAllocator is required and the memory usage will be tracked.
If the RawAllocator uses deeply_tracked_block_allocator as BlockAllocator, it will also track growth and shrinking of the allocator.
using wpi::memory::tracked_allocator< Tracker, RawAllocator >::allocator_type = typename allocator_traits<RawAllocator>::allocator_type |
using wpi::memory::tracked_allocator< Tracker, RawAllocator >::is_stateful |
using wpi::memory::tracked_allocator< Tracker, RawAllocator >::tracker = Tracker |
|
inlineexplicitnoexcept |
Tracker::on_allocator_growth()
function.
|
inlinenoexcept |
|
inlinenoexcept |
Tracker::on_allocator_shrinking()
function.
|
inlinenoexcept |
|
inline |
Tracker::on_array_allocation()
and forwards to the allocator. If a growth occurs and the allocator is deeply tracked, also calls Tracker::on_allocator_growth()
. allocate_array()
|
inline |
Tracker::on_node_allocation()
and forwards to the allocator. If a growth occurs and the allocator is deeply tracked, also calls Tracker::on_allocator_growth()
. allocate_node()
|
inlinenoexcept |
Tracker::on_array_deallocation()
and forwards to the allocator's deallocate_array()
. If shrinking occurs and the allocator is deeply tracked, also calls Tracker::on_allocator_shrinking()
.
|
inlinenoexcept |
Tracker::on_node_deallocation()
and forwards to the allocator's deallocate_node()
. If shrinking occurs and the allocator is deeply tracked, also calls Tracker::on_allocator_shrinking()
.
|
inlinenoexcept |
|
inlinenoexcept |
const
) reference to the wrapped allocator.
|
inlinenoexcept |
|
inlinenoexcept |
const
) reference to the tracker.
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
Tracker::on_array_allocation()
. try_allocate_array()
.
|
inlinenoexcept |
Tracker::on_node_allocation()
. try_allocate_node()
.
|
inlinenoexcept |
Tracker::on_array_deallocation()
. try_deallocate_array()
.
|
inlinenoexcept |
Tracker::on_node_deallocation()
. try_deallocate_node()
.
|
related |