
git-subtree-dir: deps/memkind/src git-subtree-split: bb9f19dd1b3ed6cc5e1b35919564ccf6f4b32f69
99 lines
3.6 KiB
Groff
99 lines
3.6 KiB
Groff
.\"
|
|
.\" Copyright (C) 2018 Intel Corporation.
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright notice(s),
|
|
.\" this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright notice(s),
|
|
.\" this list of conditions and the following disclaimer in the documentation
|
|
.\" and/or other materials provided with the distribution.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
|
|
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
.\" EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
.\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
.\"
|
|
.TH "PMEMALLOCATOR" 3 "2018-09-13" "Intel Corporation" "PMEMALLOCATOR" \" -*- nroff -*-
|
|
.SH "NAME"
|
|
pmem::allocator<T> \- The C++ allocator compatible with the C++ standard library allocator concepts
|
|
.br
|
|
Note: This is EXPERIMENTAL API. The functionality and the header file itself can be changed (including non-backward compatible changes), or removed.
|
|
.SH "SYNOPSIS"
|
|
.nf
|
|
.B #include <pmem_allocator.h>
|
|
.sp
|
|
.B Link with -lmemkind
|
|
.sp
|
|
.B pmem::allocator(const char *dir, size_t max_size)
|
|
.br
|
|
.B pmem::allocator(const std::string& dir, size_t max_size)
|
|
.br
|
|
.B template <typename U> pmem::allocator<T>::allocator(const pmem::allocator<U>&) noexcept
|
|
.br
|
|
.B template <typename U> pmem::allocator(const allocator<U>&& other) noexcept
|
|
.br
|
|
.B pmem::allocator<T>::~allocator()
|
|
.br
|
|
.B T* pmem::allocator<T>::allocate(std::size_t n) const
|
|
.br
|
|
.B void pmem::allocator<T>::deallocate(T* p, std::size_t n) const
|
|
.br
|
|
.B template <class U, class... Args> void pmem::allocator<T>::construct(U* p, Args... args) const
|
|
.br
|
|
.B void pmem::allocator<T>::destroy(T* p) const
|
|
.fi
|
|
.SH "DESCRIPTION"
|
|
The 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.
|
|
.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
|
|
T is an object type aliased by value_type.
|
|
.br
|
|
U is an object type.
|
|
.PP
|
|
Note:
|
|
.br
|
|
T* pmem::allocator<T>::allocate(std::size_t n)
|
|
allocates persistent memory memory using
|
|
.IR "memkind_malloc()".
|
|
Throw
|
|
.I std::bad_alloc
|
|
when:
|
|
.br
|
|
.IR n " = 0,"
|
|
.br
|
|
or there is not enough memory to satisfy the request.
|
|
|
|
.PP
|
|
void pmem::allocator<T>::deallocate(T* p, std::size_t n) deallocates memory associated with pointer returned by
|
|
.I allocate()
|
|
using
|
|
.IR "memkind_free()".
|
|
.PP
|
|
To find out more about
|
|
.I "memkind_malloc()
|
|
and
|
|
.I "memkind_free()
|
|
read memkind(3) man page.
|
|
|
|
|
|
.SH "NOTES"
|
|
The
|
|
.I pmem::allocator<T>
|
|
behavior depends on the heap manager used by memkind. Refer memkind(3) man page for more details.
|
|
.SH "COPYRIGHT"
|
|
Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
.SH "SEE ALSO"
|
|
.BR memkind_pmem(3),
|
|
.BR memkind (3)
|