ase/loft.hh file


Namespaces

namespace Ase
The Anklang C++ API namespace.
namespace Ase::Loft
Loft - A special purpose memory allocator for lock- and obstruction-free thread progress.

Classes

struct Ase::LoftFree
A std::unique_ptr<> deleter for Loft allocations.
struct Ase::LoftConfig
Configuration for Loft allocations.
struct Ase::LoftStats
Statistics for Loft allocations.
struct Ase::Loft::AllocatorBase
Internal Helper.
template <typename T>
class Ase::Loft::Allocator
Allocator for STL containers.

Enums

enum Flags: size_t { PREFAULT_PAGES = 1 }
Flags for allocator behavior.

Typedefs

template <typename T>
using LoftPtr = std::unique_ptr<T, LoftFree>
A std::unique_ptr<> for Loft allocations.

Functions

auto loft_alloc(size_t size, size_t align) →  LoftPtr<void>
Allocate size bytes (with limited alignment support), may return a nullptr.
auto loft_bucket_size(size_t nbytes) →  size_t
Calculate the real bucket size allocated for a requested size.
auto loft_calloc(size_t nelem, size_t elemsize, size_t align) →  LoftPtr<void>
Allocate and 0-initialize nelem * elemsize bytes, may return a nullptr.
void loft_get_config(LoftConfig& config)
Retrieve current configuration.
void loft_get_stats(LoftStats& stats)
Get statistics about current Loft allocations.
auto loft_grow_preallocate(size_t preallocation_amount) →  size_t
Grow the preallocated arena, issues syscalls.
template <class T, class ... Args>
auto loft_make_unique(Args && ... args) →  LoftPtr<T>
Construct an object T from Loft memory, wrapped in a unique_ptr.
void loft_set_config(const LoftConfig& config)
Configure watermark, notification, etc.
void loft_set_notifier(const std::function<void()>& lowmem)
Install obstruction free callback to notify about watermark underrun.
auto loft_stats_string(const LoftStats& stats) →  String
Stringify LoftStats.