#include <stdlib.h> int posix_memalign(void **memptr, size_t alignment, size_t size);
The posix_memalign() function allocates size bytes aligned on a boundary specified by alignment, and returns a pointer to the allocated memory in memptr. The value of alignment must be a power of two multiple of sizeof(void *).
Upon successful completion, the value pointed to by memptr will be a multiple of alignment.
If the size of the space requested is 0, the value returned in memptr will be a null pointer.
The free(3C) function will deallocate memory that has previously been allocated by posix_memalign().
Upon successful completion, posix_memalign() returns zero. Otherwise, an error number is returned to indicate the error.
The posix_memalign() function will fail if:
The value of the alignment parameter is not a power of two multiple of sizeof(void *).
There is insufficient memory available with the requested alignment.
See attributes(5) for descriptions of the following attributes:
|
free(3C), malloc(3C), memalign(3C), attributes(5), standards(5)