User Tools

Site Tools


solaris:aligned_alloc.3c

aligned_alloc


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 on a specified alignment boundary and returns a pointer to the allocated block.

The alignment argument must be a valid alignment, that is, any power of two (1, 2, 4, 8, …) and the size argument must be an integral multiple of alignment.

The free(3C) function will deallocate memory that has previously been allocated by aligned_alloc().

RETURN VALUES

Upon successful completion, aligned_alloc() returns a pointer to the allocated space. Otherwise, aligned_alloc() returns a null pointer and sets errno to indicate the error.

ERRORS

The aligned_alloc() function will fail if:

EINVAL

The value of alignment is not a power of two, or size is not a non-zero integral multiple of alignment.

ENOMEM

There is insufficient memory available with the requested alignment.

ATTRIBUTES

See attributes(7) for descriptions of the following attributes:

NOTES

The aligned_alloc() function is specified in the C11 standard (INCITS/ISO/IEC 9899:2011).

SEE ALSO

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


solaris/aligned_alloc.3c.txt · Last modified: 2023/07/19 08:57 by A User Not Logged in