106 static_assert (
sizeof(
Destructors) ==
sizeof(
void*));
107 static_assert (
sizeof(
Extents) ==
sizeof(
void*));
173 REQUIRE (not
empty());
177 return static_cast<Extent*
> (pos);
210 TRACE (memory,
"new AllocationCluster");
223 TRACE (memory,
"shutting down AllocationCluster");
243 ENSURE (allocRequest <=
max_size());
267 REQUIRE (isPow2 (align));
270 throw err::Fatal{
_Fmt{
"AllocationCluster: desired allocation of %d bytes "
271 "exceeds the fixed extent size of %d"} % allocSiz %
max_size()
275 throw err::Fatal{
_Fmt{
"AllocationCluster: data requires alignment at %d bytes, "
276 "which is beyond the fixed extent size of %d"} % align %
max_size()
299 if (not extents)
return 0;
301 return (extents - 1) *
max_size() + bytes;
Memory management for the low-level model (render nodes network).
An overlay view for the AllocationCluster to add functionality for adding / clearing extents and regi...
void attach(Destructor &dtor)
lib::LinkedElements< Extent > Extents
lib::LinkedElements< Destructor, PolicyInvokeDtor > Destructors
size_t determineExtentCnt() const
static StorageManager & access(AllocationCluster &clu)
Extent * getCurrentBlockStart() const
size_t calcAllocInCurrentBlock() const
A pile of objects sharing common allocation and lifecycle.
~AllocationCluster() noexcept
The shutdown of an AllocationCluster walks all extents and invokes all registered deleter functions a...
void expandStorage(size_t)
Expand the alloted storage pool by a block, suitable to accommodate at least the indicated request.
void __enforce_limits(size_t, size_t)
Allocation cluster uses a comparatively small tile size for its extents, which turns out to be a freq...
static constexpr size_t EXTENT_SIZ
hard wired size of storage extents
AllocationCluster()
Prepare a new clustered allocation to be expanded by extents of size EXTENT_SIZ, yet discarded all at...
void registerDestructor(Destructor &)
size_t numExtents() const
static constexpr size_t max_size()
Maximum individual allocation size that can be handled.
TY & push(TY &elm) noexcept
accept the given element and prepend it to the list of elements; depending on the allocation policy,...
TY & emplace(ARGS &&...args)
prepend object of type TY, forwarding ctor args
Derived specific exceptions within Lumiera's exception hierarchy.
Any copy and copy construction prohibited.
A front-end for using printf-style formatting.
#define ERROR_LOG_AND_IGNORE(_FLAG_, _OP_DESCR_)
convenience shortcut for a sequence of catch blocks just logging and consuming an error.
Intrusive single linked list with optional ownership.
Implementation namespace for support and library code.
auto & asLinkedElements(N *const &anchor)
transiently reinterpret an element pointer as const LinkedElements, allowing to count,...
constexpr bool isPow2(N n)
OBJ * unConst(const OBJ *)
shortcut to save some typing when having to define const and non-const variants of member functions
bool isnil(lib::time::Duration const &dur)
Block of allocated storage.
std::byte storage[max_size()]
maintaining the Allocation
Special allocator-policy for lib::LinkedElements.
void dispose(X *elm)
while this policy doesn't take ownership, it ensures the destructor is invoked
Policy for LinkedElements: never create or destroy any elements, only allow to add already existing n...
Utilities for quantisation (grid alignment) and comparisons.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...