.\" SPDX-License-Identifier: BSD-2-Clause .\" Copyright (C) 2018 - 2021 Intel Corporation. .\" .TH "PMEMALLOCATOR" 3 "2018-09-13" "Intel Corporation" "PMEMALLOCATOR" \" -*- nroff -*- .SH "NAME" libmemkind::pmem::allocator \- The C++ allocator compatible with the C++ standard library allocator concepts .br .BR Note: .I pmem_allocator.h functionality is considered as stable API (STANDARD API). .SH "SYNOPSIS" .nf .B #include .sp .B Link with -lmemkind .sp .BI "libmemkind::pmem::allocator(const char " "*dir" ", size_t " "max_size" ); .br .BI "libmemkind::pmem::allocator(const char " "&dir" ", size_t " "max_size" ", libmemkind::allocation_policy " "alloc_policy" ); .br .BI "libmemkind::pmem::allocator(const std::string " "&dir" ", size_t " "max_size" ); .br .BI "libmemkind::pmem::allocator(const std::string " "&dir" ", size_t " "max_size" ", libmemkind::allocation_policy " "alloc_policy" ); .br .BI "template libmemkind::pmem::allocator::allocator(const libmemkind::pmem::allocator&)" " "noexcept; .br .BI "template libmemkind::pmem::allocator(const allocator&& " "other" ) " "noexcept; .br .BI "libmemkind::pmem::allocator::~allocator(); .br .BI "T *libmemkind::pmem::allocator::allocate(std::size_t " "n" ) " "const; .br .BI "void libmemkind::pmem::allocator::deallocate(T " "*p" ", std::size_t " "n" ) " "const; .br .BI "template void libmemkind::pmem::allocator::construct(U " "*p" ", Args... " "args" ) " "const; .br .BI "void libmemkind::pmem::allocator::destroy(T " "*p" ) " "const; .fi .SH "DESCRIPTION" The .BR libmemkind::pmem::allocator is intended to be used with STL containers to allocate persistent memory. Memory management is based on memkind_pmem (memkind library). Refer .BR memkind_pmem (3) and .BR memkind (3) man page for more details. .PP The .BR libmemkind::allocation_policy specifies allocator memory usage policy, which allows to tune up memory utilization. The available types of allocator usage policy: .PP .B libmemkind::allocation_policy::DEFAULT Default allocator memory usage policy. .PP .B libmemkind::allocation_policy::CONSERVATIVE Conservative allocator memory usage policy - prioritize memory usage at cost of performance. .PP All public member types and functions corresponds to standard library allocator concepts and definitions. The current implementation supports C++11 standard. .PP Template arguments: .br .I T is an object type aliased by value_type. .br .I U is an object type. .PP .BR Note: .br .BI "T *libmemkind::pmem::allocator::allocate(std::size_t " "n") allocates persistent memory using .BR memkind_malloc (). Throw .I std::bad_alloc when: .br .RS .I n = 0 .RE .br .RS or there is not enough memory to satisfy the request. .RE .PP .BI "libmemkind::pmem::allocator::deallocate(T " "*p" ", std::size_t " "n") deallocates memory associated with pointer returned by .BR allocate () using .BR memkind_free (). .SH "COPYRIGHT" Copyright (C) 2018 - 2021 Intel Corporation. All rights reserved. .SH "SEE ALSO" .BR memkind_pmem (3), .BR memkind (3)