libmemkind::pmem::allocator<T> - The C++ allocator compatible with the C++ standard library allocator
Contents
Copyright
Copyright (C) 2018 - 2021 Intel Corporation. All rights reserved.
Description
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_tn) 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_tn) deallocates memory associated with
pointer returned by allocate() using memkind_free().
Name
libmemkind::pmem::allocator<T> - The C++ allocator compatible with the C++ standard library allocator
concepts
Note:pmem_allocator.h functionality is considered as stable API (STANDARD API).
See Also
memkind_pmem(3), memkind(3) Intel Corporation 2018-09-13 PMEMALLOCATOR(3)
Synopsis
#include<pmem_allocator.h>Linkwith-lmemkindlibmemkind::pmem::allocator(constchar*dir,size_tmax_size);libmemkind::pmem::allocator(constchar&dir,size_tmax_size,libmemkind::allocation_policyalloc_policy);libmemkind::pmem::allocator(conststd::string&dir,size_tmax_size);libmemkind::pmem::allocator(conststd::string&dir,size_tmax_size,libmemkind::allocation_policyalloc_policy);template<typenameU>libmemkind::pmem::allocator<T>::allocator(constlibmemkind::pmem::allocator<U>&)noexcept;template<typenameU>libmemkind::pmem::allocator(constallocator<U>&&other)noexcept;libmemkind::pmem::allocator<T>::~allocator();T*libmemkind::pmem::allocator<T>::allocate(std::size_tn)const;voidlibmemkind::pmem::allocator<T>::deallocate(T*p,std::size_tn)const;template<classU,class...Args>voidlibmemkind::pmem::allocator<T>::construct(U*p,Args...args)const;voidlibmemkind::pmem::allocator<T>::destroy(T*p)const;
