Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/test/tracking-allocator.hpp"
C++ standard compliant custom allocator adapter backed by the TrackingAllocator and the MemoryPool denoted at construction.
TrackAlloc adapters can be default constructed (thereby using the GLOBAL pool), or created with a designated pool-ID or copy/move constructed from any other TrackAlloc adapter (then using the same backing pool)
TY | the type of intended product object, to determine the size |
Definition at line 139 of file tracking-allocator.hpp.
Public Types | |
using | propagate_on_container_copy_assignment = std::true_type |
for sake of consistency | |
using | propagate_on_container_move_assignment = std::true_type |
otherwise all elements must be copied | |
using | propagate_on_container_swap = std::true_type |
otherwise they would have to deallocate cross-wise | |
using | value_type = TY |
Public Types inherited from TrackingAllocator | |
using | Location = void * |
Public Member Functions | |
template<typename X > | |
TrackAlloc (TrackAlloc< X > const &anchor) | |
cross-building for another type, using a common pool | |
TY * | allocate (size_t cnt) |
C++ standard allocator API : allot raw memory for cnt elements of type TY. | |
void | deallocate (TY *, size_t) noexcept |
C++ standard allocator API : clear an existing allocation, which must have been allocated into the same pool, with given element cnt. | |
Public Member Functions inherited from TrackingAllocator | |
TrackingAllocator () | |
can be default created to attach to a common pool | |
TrackingAllocator (Literal id) | |
create a separate, marked memory pool | |
Location | allocate (size_t n) |
Allot a memory block of given size bytes. More... | |
void | deallocate (Location, size_t=0) noexcept |
Discard and forget an allocation created through this allocator. More... | |
HashVal | getID (Location) const |
retrieve the internal registration ID for this allocation. More... | |
size_t | getSize (Location) const |
retrieve the registered size of this allocation, if known. More... | |
bool | manages (Location) const |
probe if this allocator pool did allocate the given memory location | |
Literal | poolID () const |
Additional Inherited Members | |
Static Public Member Functions inherited from TrackingAllocator | |
static HashVal | checksum (Literal pool=GLOBAL) |
get Checksum for specific mem-pool | |
static size_t | numAlloc (Literal pool=GLOBAL) |
get active allocation count for mem-pool | |
static size_t | numBytes (Literal pool=GLOBAL) |
calculate currently allotted Bytes for mem-pool | |
static size_t | use_count (Literal pool=GLOBAL) |
determine number of active front-end handles | |
Static Public Attributes inherited from TrackingAllocator | |
static EventLog | log {"test::TrackingAllocator"} |