|
Packit |
345191 |
.\"
|
|
Packit |
345191 |
.\" Copyright (C) 2018 - 2019 Intel Corporation.
|
|
Packit |
345191 |
.\" All rights reserved.
|
|
Packit |
345191 |
.\"
|
|
Packit |
345191 |
.\" Redistribution and use in source and binary forms, with or without
|
|
Packit |
345191 |
.\" modification, are permitted provided that the following conditions are met:
|
|
Packit |
345191 |
.\" 1. Redistributions of source code must retain the above copyright notice(s),
|
|
Packit |
345191 |
.\" this list of conditions and the following disclaimer.
|
|
Packit |
345191 |
.\" 2. Redistributions in binary form must reproduce the above copyright notice(s),
|
|
Packit |
345191 |
.\" this list of conditions and the following disclaimer in the documentation
|
|
Packit |
345191 |
.\" and/or other materials provided with the distribution.
|
|
Packit |
345191 |
.\"
|
|
Packit |
345191 |
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
|
|
Packit |
345191 |
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
Packit |
345191 |
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
Packit |
345191 |
.\" EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
Packit |
345191 |
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit |
345191 |
.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
Packit |
345191 |
.\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
Packit |
345191 |
.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
Packit |
345191 |
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
Packit |
345191 |
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
345191 |
.\"
|
|
Packit |
345191 |
.TH "PMEMALLOCATOR" 3 "2018-09-13" "Intel Corporation" "PMEMALLOCATOR" \" -*- nroff -*-
|
|
Packit |
345191 |
.SH "NAME"
|
|
Packit |
345191 |
libmemkind::pmem::allocator<T> \- The C++ allocator compatible with the C++ standard library allocator concepts
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BR Note:
|
|
Packit |
345191 |
.I pmem_allocator.h
|
|
Packit |
345191 |
functionality is considered as stable API (STANDARD API).
|
|
Packit |
345191 |
.SH "SYNOPSIS"
|
|
Packit |
345191 |
.nf
|
|
Packit |
345191 |
.B #include <pmem_allocator.h>
|
|
Packit |
345191 |
.sp
|
|
Packit |
345191 |
.B Link with -lmemkind
|
|
Packit |
345191 |
.sp
|
|
Packit |
345191 |
.BI "libmemkind::pmem::allocator(const char " "*dir" ", size_t " "max_size" );
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BI "libmemkind::pmem::llocator(const char " "&dir" ", size_t " "max_size" ", libmemkind::allocation_policy " "alloc_policy" );
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BI "libmemkind::pmem::allocator(const std::string " "&dir" ", size_t " "max_size" );
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BI "libmemkind::pmem::allocator(const std::string " "&dir" ", size_t " "max_size" ", libmemkind::allocation_policy " "alloc_policy" );
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BI "template <typename U> libmemkind::pmem::allocator<T>::allocator(const libmemkind::pmem::allocator<U>&)" " "noexcept;
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BI "template <typename U> libmemkind::pmem::allocator(const allocator<U>&& " "other" ) " "noexcept;
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BI "libmemkind::pmem::allocator<T>::~allocator();
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BI "T *libmemkind::pmem::allocator<T>::allocate(std::size_t " "n" ) " "const;
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BI "void libmemkind::pmem::allocator<T>::deallocate(T " "*p" ", std::size_t " "n" ) " "const;
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BI "template <class U, class... Args> void libmemkind::pmem::allocator<T>::construct(U " "*p" ", Args... " "args" ) " "const;
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BI "void libmemkind::pmem::allocator<T>::destroy(T " "*p" ) " "const;
|
|
Packit |
345191 |
.fi
|
|
Packit |
345191 |
.SH "DESCRIPTION"
|
|
Packit |
345191 |
The
|
|
Packit |
345191 |
.BR libmemkind::pmem::allocator<T>
|
|
Packit |
345191 |
is intended to be used with STL containers to allocate persistent memory. Memory management is based on memkind_pmem (memkind library). Refer
|
|
Packit |
345191 |
.BR memkind_pmem (3)
|
|
Packit |
345191 |
and
|
|
Packit |
345191 |
.BR memkind (3)
|
|
Packit |
345191 |
man page for more details.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
The
|
|
Packit |
345191 |
.BR libmemkind::allocation_policy
|
|
Packit |
345191 |
specifies allocator memory usage policy, which allows to tune up memory utilization. The available types of allocator usage policy:
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.B libmemkind::allocation_policy::DEFAULT
|
|
Packit |
345191 |
Default allocator memory usage policy.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.B libmemkind::allocation_policy::CONSERVATIVE
|
|
Packit |
345191 |
Conservative allocator memory usage policy - prioritize memory usage at cost of performance.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
All public member types and functions corresponds to standard library allocator concepts and definitions. The current implementation supports C++11 standard.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
Template arguments:
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.I T
|
|
Packit |
345191 |
is an object type aliased by value_type.
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.I U
|
|
Packit |
345191 |
is an object type.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR Note:
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.BI "T *libmemkind::pmem::allocator<T>::allocate(std::size_t " "n")
|
|
Packit |
345191 |
allocates persistent memory using
|
|
Packit |
345191 |
.BR memkind_malloc ().
|
|
Packit |
345191 |
Throw
|
|
Packit |
345191 |
.I std::bad_alloc
|
|
Packit |
345191 |
when:
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.RS
|
|
Packit |
345191 |
.I n
|
|
Packit |
345191 |
= 0
|
|
Packit |
345191 |
.RE
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.RS
|
|
Packit |
345191 |
or there is not enough memory to satisfy the request.
|
|
Packit |
345191 |
.RE
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BI "libmemkind::pmem::allocator<T>::deallocate(T " "*p" ", std::size_t " "n")
|
|
Packit |
345191 |
deallocates memory associated with pointer returned by
|
|
Packit |
345191 |
.BR allocate ()
|
|
Packit |
345191 |
using
|
|
Packit |
345191 |
.BR memkind_free ().
|
|
Packit |
345191 |
|
|
Packit |
345191 |
.SH "COPYRIGHT"
|
|
Packit |
345191 |
Copyright (C) 2018 - 2019 Intel Corporation. All rights reserved.
|
|
Packit |
345191 |
.SH "SEE ALSO"
|
|
Packit |
345191 |
.BR memkind_pmem (3),
|
|
Packit |
345191 |
.BR memkind (3)
|