posix_memalign()

Defined in stdlib.h, this function provides aligned memory allocation. It is fully POSIX-compliant.

Show/hideSyntax

int posix_memalign(void **memptr, size_t alignment, size_t size);

Show/hideUsage

This function allocates size bytes of memory at an address that is a multiple of alignment.

The value of alignment must be a power of two and a multiple of sizeof(void *).

You can free memory allocated by posix_memalign() using the standard C library free() function.

Show/hideReturns

The returned address is written to the void * variable pointed to by memptr.

The integer return value from the function is zero on success, or an error code on failure.

If no block of memory can be found with the requested size and alignment, the function returns ENOMEM and the value of *memptr is undefined.

Show/hideSee also

Copyright © 2010-2011 ARM. All rights reserved.ARM DUI 0492F
Non-ConfidentialID091611