22 void (*dtor_) (
void*) =
nullptr;
23 void operator() (
void*);
34LoftPtr<void> loft_calloc (
size_t nelem,
size_t elemsize,
size_t align = 0);
37template<
class T,
class ...Args>
41size_t loft_bucket_size (
size_t nbytes);
51void loft_set_config (
const LoftConfig &config);
60size_t loft_grow_preallocate (
size_t preallocation_amount = 0);
94 bool operator== (
const Allocator<T> &o)
const noexcept {
return true; }
95 bool operator!= (
const Allocator<T> &o)
const noexcept {
return !this->operator== (o); }
96 constexpr void deallocate (T *p,
size_t n)
const noexcept {
loft_btfree (p, n); }
97 [[nodiscard]]
constexpr T*
100 void *
const mem =
loft_btalloc (n *
sizeof (T),
alignof (T));
103 return reinterpret_cast<T*
> (mem);
105 static constexpr bool allows_read_after_free =
true;
111template<
class T,
class ...Args>
inline LoftPtr<T>
120 lfree.dtor_ = [] (
void *p) {
121 T *
const t =
static_cast<T*
> (p);
Allocator for STL containers.
#define ASE_ASSERT_WARN(expr)
Issue an assertion warning if expr evaluates to false.
Flags
Flags for allocator behavior.
The Anklang C++ API namespace.
size_t maxchunk
Memory preallocated in Arenas.
size_t available
Total number of arenas.
size_t allocated
Memory still allocatable from Arenas.
LoftPtr< T > loft_make_unique(Args &&...args)
Construct an object T from Loft memory, wrapped in a unique_ptr.
size_t preallocate
Amount of preallocated available memory.
size_t watermark
Watermark to trigger async preallocation.
Configuration for Loft allocations.
Statistics for Loft allocations.
A std::unique_ptr<> deleter for Loft allocations.
static void loft_btfree(void *p, size_t size)
Free memory allocted from loft_btalloc().
static void * loft_btalloc(size_t size, size_t align)
Alloc in a fashion similar to malloc(), using boundary tags.