PMEMCTO_ALIGNED_ALLOC(3)

NAME

pmemcto_aligned_alloc – allocate aligned memory

SYNOPSIS

    #include <libpmemcto.h>
    void *pmemcto_aligned_alloc(PMEMctopool *pcp, size_t alignment, size_t size);

DESCRIPTION

The pmemcto_aligned_alloc() function provides the same semantics as aligned_alloc(3), but operates on the memory pool pcp instead of the process heap supplied by the system. It allocates size 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 alignment, which must be a power of two.

RETURN VALUE

On success, pmemcto_aligned_alloc() function returns a pointer to the allocated memory. If size is 0, then pmemcto_aligned_alloc() returns either NULL, or a unique pointer value that can later be successfully passed to pmemcto_free(3). If pmemcto_aligned_alloc() is unable to satisfy the allocation request, a NULL pointer is returned and errno is set appropriately.

ERRORS

EINVAL alignment was not a power of two.

ENOMEM Insufficient memory available to satisfy allocation request.

SEE ALSO

aligned_alloc(3), malloc(3), jemalloc(3), pmemcto_malloc(3), libpmemcto(7) and <http://pmem.io>