1PMEMALLOCATOR(3) PMEMALLOCATOR PMEMALLOCATOR(3)
2
3
4
6 pmem::allocator<T> - The C++ allocator compatible with the C++ standard
7 library allocator concepts
8 Note: This is EXPERIMENTAL API. The functionality and the header file
9 itself can be changed (including non-backward compatible changes), or
10 removed.
11
13 #include <pmem_allocator.h>
14
15 Link with -lmemkind
16
17 pmem::allocator(const char *dir, size_t max_size);
18 pmem::allocator(const std::string &dir, size_t max_size);
19 template <typename U> pmem::allocator<T>::allocator(const pmem::allocator<U>&) noexcept;
20 template <typename U> pmem::allocator(const allocator<U>&& other) noexcept;
21 pmem::allocator<T>::~allocator();
22 T *pmem::allocator<T>::allocate(std::size_t n) const;
23 void pmem::allocator<T>::deallocate(T *p, std::size_t n) const;
24 template <class U, class... Args> void pmem::allocator<T>::construct(U *p, Args... args) const;
25 void pmem::allocator<T>::destroy(T *p) const;
26
28 The pmem::allocator<T> is intended to be used with STL containers to
29 allocate persistent memory. Memory management is based on memkind_pmem
30 (memkind library). Refer memkind_pmem(3) and memkind(3) man page for
31 more details.
32
33 All public member types and functions corresponds to standard library
34 allocator concepts and definitions. The current implementation supports
35 C++11 standard.
36
37 Template arguments:
38 T is an object type aliased by value_type.
39 U is an object type.
40
41 Note:
42 T *pmem::allocator<T>::allocate(std::size_t n) allocates persistent
43 memory memory using memkind_malloc(). Throw std::bad_alloc when:
44 n = 0
45 or there is not enough memory to satisfy the request.
46
47 pmem::allocator<T>::deallocate(T *p, std::size_t n) deallocates memory
48 associated with pointer returned by allocate() using memkind_free().
49
50
52 Copyright (C) 2018 - 2019 Intel Corporation. All rights reserved.
53
55 memkind_pmem(3), memkind(3)
56
57
58
59Intel Corporation 2018-09-13 PMEMALLOCATOR(3)