ALIGNED_ALLOC(3C) Standard C Library Functions ALIGNED_ALLOC(3C)

NAME


aligned_alloc - aligned memory allocation

SYNOPSIS


#include <stdlib.h>

void *
aligned_alloc(size_t alignment, size_t size);

DESCRIPTION


The aligned_alloc() function allocates size bytes aligned on the specified
alignment boundary alignment. The value of alignment is constrained, it
must be a power of two and it must be greater than or equal to the size of
a word on the platform.

RETURN VALUES


Upon successful completion, the aligned_alloc() function returns a pointer
to suitably aligned memory at least size bytes large. Otherwise, a NULL
pointer is returned and errno is set to indicate the error.

ERRORS


The aligned_alloc() function will fail if:

ENOMEM The physical limits of the system are exceeded by size
bytes of memory which cannot be allocated.

EAGAIN There is not enough memory available to allocate size
bytes of memory; but the application could try again
later.

EINVAL An invalid value for alignment was passed in. It is not
a power of two multiple of the word size.

INTERFACE STABILITY


STANDARD

MT-LEVEL
MT-Safe

SEE ALSO


malloc(3C), memalign(3C), posix_memalign(3C), attributes(7)

OmniOS March 26, 2016 OmniOS