Lumiera  0.pre.03
»edit your freedom«
allocator-handle.hpp File Reference

Go to the source code of this file.

Description

A front-end/concept to allow access to custom memory management.

Minimalistic definition scheme for a functor-like object, which can be passed to client code, offering a callback to generate new objects into some custom allocation scheme not further disclosed.

Lumiera employs various flavours of custom memory management, to handle allocation demands from performance critical parts of the application. Irrespective of the actual specifics of the allocation, typically there is some instance of an allocator maintained within a carefully crafted context — leading to the necessity to dependency-inject a suitable front-end into various connected parts of the application, to allow for coherent use of allocation while avoiding tight coupling of implementation internals.

Reduced to the bare minimum, the ability to allocate can be represented as a functor, which accepts arbitrary (suitable) arguments and returns a reference to a newly allocated instance of some specific type; such an allocation front-end may then be passed as additional (template) parameter to associated classes or functions, allowing to generate new objects at stable memory location, which can then be wired internally.

Todo:
6/2023 this specification describes a Concept, not an actual interface type. After the migration to C++20, it will thus be possible to mark some arbitrary custom allocator / front-end with such a concept, thereby documenting proper API usage.
See also
allocation-cluster.hpp
steam::fixture::Segment
steam::engine::JobTicket

Definition in file allocator-handle.hpp.

#include "lib/error.hpp"
#include <cstddef>
#include <utility>
#include <list>

Classes

struct  AllocatorHandle< TY >::Allocation
 
class  AllocatorHandle< TY >
 Placeholder implementation for a custom allocator. More...
 

Namespaces

 lib
 Implementation namespace for support and library code.