template<class Tracker, class RawAllocator>
class foonathan::memory::deeply_tracked_allocator< Tracker, RawAllocator >
A tracked_allocator that has rebound any BlockAllocator to the corresponding deeply_tracked_block_allocator.
This makes it a deeply tracked allocator.
It replaces each template argument of the given RawAllocator for which is_block_allocator or is_raw_allocator is true
with a deeply_tracked_block_allocator.
|
using | allocator_type = typename allocator_traits< detail::rebound_allocator< Tracker, RawAllocator > >::allocator_type |
|
using | tracker = Tracker |
|
using | is_stateful = std::integral_constant< bool, traits::is_stateful::value||!std::is_empty< Tracker >::value > |
|
|
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 |
|
|
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 |
|
◆ allocate_node()
void * allocate_node |
( |
std::size_t |
size, |
|
|
std::size_t |
alignment |
|
) |
| |
|
inherited |
- Effects:
- Calls
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()
.
- Returns:
- The result of
allocate_node()
◆ try_allocate_node()
void * try_allocate_node |
( |
std::size_t |
size, |
|
|
std::size_t |
alignment |
|
) |
| |
|
noexceptinherited |
- Effects:
- Calls the composable node allocation function. If allocation was successful, also calls
Tracker::on_node_allocation()
.
- Returns:
- The result of
try_allocate_node()
.
◆ allocate_array()
void * allocate_array |
( |
std::size_t |
count, |
|
|
std::size_t |
size, |
|
|
std::size_t |
alignment |
|
) |
| |
|
inherited |
- Effects:
- Calls
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()
.
- Returns:
- The result of
allocate_array()
◆ try_allocate_array()
void * try_allocate_array |
( |
std::size_t |
count, |
|
|
std::size_t |
size, |
|
|
std::size_t |
alignment |
|
) |
| |
|
noexceptinherited |
- Effects:
- Calls the composable array allocation function. If allocation was succesful, also calls
Tracker::on_array_allocation()
.
- Returns:
- The result of
try_allocate_array()
.
◆ deallocate_node()
void deallocate_node |
( |
void * |
ptr, |
|
|
std::size_t |
size, |
|
|
std::size_t |
alignment |
|
) |
| |
|
noexceptinherited |
- Effects:
- Calls
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()
.
◆ try_deallocate_node()
bool try_deallocate_node |
( |
void * |
ptr, |
|
|
std::size_t |
size, |
|
|
std::size_t |
alignment |
|
) |
| |
|
noexceptinherited |
- Effects:
- Calls the composable node deallocation function. If it was succesful, also calls
Tracker::on_node_deallocation()
.
- Returns:
- The result of
try_deallocate_node()
.
◆ deallocate_array()
void deallocate_array |
( |
void * |
ptr, |
|
|
std::size_t |
count, |
|
|
std::size_t |
size, |
|
|
std::size_t |
alignment |
|
) |
| |
|
noexceptinherited |
- Effects:
- Calls
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()
.
◆ try_deallocate_array()
bool try_deallocate_array |
( |
void * |
ptr, |
|
|
std::size_t |
count, |
|
|
std::size_t |
size, |
|
|
std::size_t |
alignment |
|
) |
| |
|
noexceptinherited |
- Effects:
- Calls the composable array deallocation function. If it was succesful, also calls
Tracker::on_array_deallocation()
.
- Returns:
- The result of
try_deallocate_array()
.
◆ max_node_size()
std::size_t max_node_size |
( |
| ) |
const |
|
inherited |
- Returns:
- The result of the corresponding function on the wrapped allocator.
◆ max_array_size()
std::size_t max_array_size |
( |
| ) |
const |
|
inherited |
- Returns:
- The result of the corresponding function on the wrapped allocator.
◆ max_alignment()
std::size_t max_alignment |
( |
| ) |
const |
|
inherited |
- Returns:
- The result of the corresponding function on the wrapped allocator.
◆ get_allocator() [1/2]
allocator_type & get_allocator |
( |
| ) |
|
|
noexceptinherited |
- Returns:
- A (
const
) reference to the wrapped allocator.
◆ get_allocator() [2/2]
const allocator_type & get_allocator |
( |
| ) |
const |
|
noexceptinherited |
- Returns:
- A (
const
) reference to the wrapped allocator.
◆ get_tracker() [1/2]
tracker & get_tracker |
( |
| ) |
|
|
noexceptinherited |
- Returns:
- A (
const
) reference to the tracker.
◆ get_tracker() [2/2]
const tracker & get_tracker |
( |
| ) |
const |
|
noexceptinherited |
- Returns:
- A (
const
) reference to the tracker.
◆ make_deeply_tracked_allocator()
◆ make_tracked_allocator()
auto make_tracked_allocator |
( |
Tracker |
t, |
|
|
detail::rebound_allocator< Tracker, RawAllocator > && |
alloc |
|
) |
| -> tracked_allocator<Tracker, typename std::decay<detail::rebound_allocator< Tracker, RawAllocator > >::type> |
|
related |