1PMEMALLOCATOR(3) PMEMALLOCATOR PMEMALLOCATOR(3)
2
3
4
6 libmemkind::pmem::allocator<T> - The C++ allocator compatible with the
7 C++ standard library allocator concepts
8 Note: pmem_allocator.h functionality is considered as stable API (STAN‐
9 DARD API).
10
12 #include <pmem_allocator.h>
13
14 Link with -lmemkind
15
16 libmemkind::pmem::allocator(const char *dir, size_t max_size);
17 libmemkind::pmem::allocator(const char &dir, size_t max_size, libmemkind::allocation_policy alloc_policy);
18 libmemkind::pmem::allocator(const std::string &dir, size_t max_size);
19 libmemkind::pmem::allocator(const std::string &dir, size_t max_size, libmemkind::allocation_policy alloc_policy);
20 template <typename U> libmemkind::pmem::allocator<T>::allocator(const libmemkind::pmem::allocator<U>&) noexcept;
21 template <typename U> libmemkind::pmem::allocator(const allocator<U>&& other) noexcept;
22 libmemkind::pmem::allocator<T>::~allocator();
23 T *libmemkind::pmem::allocator<T>::allocate(std::size_t n) const;
24 void libmemkind::pmem::allocator<T>::deallocate(T *p, std::size_t n) const;
25 template <class U, class... Args> void libmemkind::pmem::allocator<T>::construct(U *p, Args... args) const;
26 void libmemkind::pmem::allocator<T>::destroy(T *p) const;
27
29 The libmemkind::pmem::allocator<T> is intended to be used with STL con‐
30 tainers to allocate persistent memory. Memory management is based on
31 memkind_pmem (memkind library). Refer memkind_pmem(3) and memkind(3)
32 man page for more details.
33
34 The libmemkind::allocation_policy specifies allocator memory usage pol‐
35 icy, which allows to tune up memory utilization. The available types of
36 allocator usage policy:
37
38 libmemkind::allocation_policy::DEFAULT Default allocator memory usage
39 policy.
40
41 libmemkind::allocation_policy::CONSERVATIVE Conservative allocator mem‐
42 ory usage policy - prioritize memory usage at cost of performance.
43
44 All public member types and functions corresponds to standard library
45 allocator concepts and definitions. The current implementation supports
46 C++11 standard.
47
48 Template arguments:
49 T is an object type aliased by value_type.
50 U is an object type.
51
52 Note:
53 T *libmemkind::pmem::allocator<T>::allocate(std::size_t n) allocates
54 persistent memory using memkind_malloc(). Throw std::bad_alloc when:
55 n = 0
56 or there is not enough memory to satisfy the request.
57
58 libmemkind::pmem::allocator<T>::deallocate(T *p, std::size_t n) deallo‐
59 cates memory associated with pointer returned by allocate() using
60 memkind_free().
61
62
64 Copyright (C) 2018 - 2021 Intel Corporation. All rights reserved.
65
67 memkind_pmem(3), memkind(3)
68
69
70
71Intel Corporation 2018-09-13 PMEMALLOCATOR(3)