![]() |
Lumiera 0.pre.04
»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 | value_type = TY |
| 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 | |
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. | |
| TrackingAllocator () | |
| can be default created to attach to a common pool | |
| TrackingAllocator (Literal id) | |
| create a separate, marked memory pool | |
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. | |
| void | deallocate (Location, size_t=0) noexcept |
| Discard and forget an allocation created through this allocator. | |
| bool | manages (Location) const |
| probe if this allocator pool did allocate the given memory location | |
| size_t | getSize (Location) const |
| retrieve the registered size of this allocation, if known. | |
| HashVal | getID (Location) const |
| retrieve the internal registration ID for this allocation. | |
| Literal | poolID () const |
Additional Inherited Members | |
Static Public Attributes inherited from TrackingAllocator | |
| static EventLog | log {"test::TrackingAllocator"} |
Static Public Member Functions inherited from TrackingAllocator | |
| static HashVal | checksum (Literal pool=GLOBAL) |
| get Checksum for specific mem-pool | |
| static size_t | use_count (Literal pool=GLOBAL) |
| determine number of active front-end handles | |
| 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 | |
cross-building for another type, using a common pool
Definition at line 147 of file tracking-allocator.hpp.
| using value_type = TY |
Definition at line 154 of file tracking-allocator.hpp.
| using propagate_on_container_copy_assignment = std::true_type |
for sake of consistency
Definition at line 157 of file tracking-allocator.hpp.
| using propagate_on_container_move_assignment = std::true_type |
otherwise all elements must be copied
Definition at line 158 of file tracking-allocator.hpp.
| using propagate_on_container_swap = std::true_type |
otherwise they would have to deallocate cross-wise
Definition at line 159 of file tracking-allocator.hpp.
| TY * allocate | ( | size_t | cnt | ) |
C++ standard allocator API : allot raw memory for cnt elements of type TY.
Definition at line 227 of file tracking-allocator.hpp.
References TrackingAllocator::allocate().
Here is the call graph for this function:
|
noexcept |
C++ standard allocator API : clear an existing allocation, which must have been allocated into the same pool, with given element cnt.
Definition at line 238 of file tracking-allocator.hpp.
References TrackingAllocator::deallocate().
Here is the call graph for this function:| TrackingAllocator | ( | ) |
can be default created to attach to a common pool
Definition at line 89 of file tracking-allocator.cpp.
| TrackingAllocator | ( | Literal | id | ) |
create a separate, marked memory pool
Definition at line 92 of file tracking-allocator.cpp.
Inheritance diagram for TrackAlloc< TY >:
Collaboration diagram for TrackAlloc< TY >: