FIXEDALLOCATOR(3)
π NAME π
libmemkind::fixed::allocator<T> β bestie, this is the C++ allocator that plays nice with all the C++ standard library allocator concepts π«Ά
ok so quick note before we start: fixed_allocator.h is part of the stable API (STANDARD API) β¨ so you can build on it without the vibes getting weird.
πΈ SYNOPSIS πΈ
#include <fixed_allocator.h>
Link with -lmemkind π
libmemkind::fixed::allocator(void *addr, size_t size);
template <typename U> libmemkind::fixed::allocator<T>::allocator(const libmemkind::fixed::allocator<U>&) noexcept;
template <typename U> libmemkind::fixed::allocator<T>::allocator(allocator<U>&& other) noexcept;
libmemkind::fixed::allocator<T>::~allocator();
T *libmemkind::fixed::allocator<T>::allocate(std::size_t n) const;
void libmemkind::fixed::allocator<T>::deallocate(T *p, std::size_t n) const;
template <class U, class... Args> void libmemkind::fixed::allocator<T>::construct(U *p, Args... &&args) const;
void libmemkind::fixed::allocator<T>::destroy(T *p) const;
π¦ DESCRIPTION π¦
So like. libmemkind::fixed::allocator<T> is the one you pair with your STL containers when you want your memory to live on a specific area you picked out yourself π
The actual memory management? Handled by jemalloc, but only on the area you supplied. For the full lore, go read the memkind(3) man page, iykyk.
Every public member type and function lines up with the standard library allocator concepts and definitions β no rogue behaviour, no surprises, periodt. The current implementation supports the C++11 standard. π₯
π Template arguments π
Tβ an object type aliased byvalue_typeβ¨Uβ an object type π
π Note π
T *libmemkind::fixed::allocator<T>::allocate(std::size_t n) allocates memory using memkind_malloc() on the area that was supplied to libmemkind::fixed::allocator(). It throws std::bad_alloc when:
n = 0- or there is not enough memory to satisfy the request π
And libmemkind::fixed::allocator<T>::deallocate(T *p, std::size_t n) deallocates the memory associated with a pointer returned by allocate(), using memkind_free(). Clean up after yourself bestie π§
π COPYRIGHT π
Copyright (C) 2021 Intel Corporation. All rights reserved.
β SEE ALSO β
ok that's the whole page, mwah π brought to you by Intel Corporation, dated 2021-12-03, filed under FIXEDALLOCATOR(3) β go forth and allocate responsibly, bestie πβ¨
π¦ where this page comes from
- debian bookworm: libmemkind-dev 1.14.0-2 Β· BSD-3-Clause
- fedora 43: memkind-devel 1.14.0-11.fc43 Β· BSD-2-Clause
- ubuntu jammy: libmemkind-dev 1.13.0-1 Β· BSD-3-Clause
- ubuntu noble: libmemkind-dev 1.14.0-3build1 Β· BSD-3-Clause
- π the page's license: BSD-2-Clause
- Copyright (C) 2021 Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms