.\" Automatically generated by Pandoc 1.16.0.2
.\"
.TH "PMEMCTO_ALIGNED_ALLOC" "3" "2017-12-22" "PMDK - libpmemcto API version 1.0" "PMDK Programmer's Manual"
.hy
.\" Copyright 2014-2017, Intel Corporation
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" * Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\"
.\" * Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" * Neither the name of the copyright holder nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
.\" "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
.\" OWNER OR CONTRIBUTORS 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.
.SH NAME
.PP
pmemcto_aligned_alloc \-\- allocate aligned memory
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <libpmemcto.h>
void\ *pmemcto_aligned_alloc(PMEMctopool\ *pcp,\ size_t\ alignment,\ size_t\ size);
\f[]
.fi
.SH DESCRIPTION
.PP
The \f[B]pmemcto_aligned_alloc\f[]() function provides the same
semantics as \f[B]aligned_alloc\f[](3), but operates on the memory pool
\f[I]pcp\f[] instead of the process heap supplied by the system.
It allocates \f[I]size\f[] bytes from the memory pool and returns a
pointer to the allocated memory.
The memory is not zeroed.
The memory address will be a multiple of \f[I]alignment\f[], which must
be a power of two.
.SH RETURN VALUE
.PP
On success, \f[B]pmemcto_aligned_alloc\f[]() function returns a pointer
to the allocated memory.
If \f[I]size\f[] is 0, then \f[B]pmemcto_aligned_alloc\f[]() returns
either NULL, or a unique pointer value that can later be successfully
passed to \f[B]pmemcto_free\f[](3).
If \f[B]pmemcto_aligned_alloc\f[]() is unable to satisfy the allocation
request, a NULL pointer is returned and \f[I]errno\f[] is set
appropriately.
.SH ERRORS
.PP
\f[B]EINVAL\f[] \f[I]alignment\f[] was not a power of two.
.PP
\f[B]ENOMEM\f[] Insufficient memory available to satisfy allocation
request.
.SH SEE ALSO
.PP
\f[B]pmemcto_malloc\f[](3), \f[B]aligned_alloc\f[](3),
\f[B]malloc\f[](3), \f[B]jemalloc\f[](3), \f[B]libpmemcto\f[](7) and
\f[B]<http://pmem.io>\f[]