pmemallocator(3)

pmemallocator3

The c++ allocator compatible with the c++ standard library allocator concepts note: pmem_allocator.h functionality is considered as stable api (standard api).

Usage

#include <pmem_allocator.h>

Link with -lmemkind

libmemkind::pmem::allocator(const char *dir, size_t max_size);
libmemkind::pmem::allocator(const char &dir, size_t max_size, libmemkind::allocation_policy alloc_policy);
libmemkind::pmem::allocator(const std::string &dir, size_t max_size);
libmemkind::pmem::allocator(const std::string &dir, size_t max_size, libmemkind::allocation_policy alloc_policy);
template <typename U> libmemkind::pmem::allocator<T>::allocator(const libmemkind::pmem::allocator<U>&) noexcept;
template <typename U> libmemkind::pmem::allocator(const allocator<U>&& other) noexcept;
libmemkind::pmem::allocator<T>::~allocator();
T *libmemkind::pmem::allocator<T>::allocate(std::size_t n) const;
void libmemkind::pmem::allocator<T>::deallocate(T *p, std::size_t n) const;
template <class U, class... Args> void libmemkind::pmem::allocator<T>::construct(U *p, Args... args) const;
void libmemkind::pmem::allocator<T>::destroy(T *p) const;

Overview

The libmemkind::pmem::allocator<T> is intended to be used with STL containers to allocate persistent memory. Memory management is based on memkind_pmem (memkind library). Refer memkind_pmem(3) and memkind(3) man page for more details.

The libmemkind::allocation_policy specifies allocator memory usage policy, which allows to tune up memory utilization. The available types of allocator usage policy:

libmemkind::allocation_policy::DEFAULT Default allocator memory usage policy.

libmemkind::allocation_policy::CONSERVATIVE Conservative allocator memory usage policy - prioritize memory usage at cost of performance.

All public member types and functions corresponds to standard library allocator concepts and definitions. The current implementation supports C++11 standard.

Template arguments:
T is an object type aliased by value_type.
U is an object type.

Note:
T *libmemkind::pmem::allocator<T>::allocate(std::size_t n) allocates persistent memory using memkind_malloc(). Throw std::bad_alloc when:

n = 0

or there is not enough memory to satisfy the request.

libmemkind::pmem::allocator<T>::deallocate(T *p, std::size_t n) deallocates memory associated with pointer returned by allocate() using memkind_free().

Releases

3 releases since Debian 10 (Buster); the text changed 2 times.

  1. 10
  2. 11
  3. 12

From libmemkind-dev 1.14.0-2 in Debian 12 (Bookworm). Parsed by carta from the page's man source.