Defined in header
size bytes of uninitialized storage whose alignment is specified by
size parameter must be an integral multiple of
aligned_alloc is thread-safe: it behaves as though only accessing the memory locations visible through its argument, and not any static storage.
A previous call to free or realloc that deallocates a region of memory synchronizes-with a call to aligned_alloc that allocates the same or a part of the same region of memory. This synchronization occurs after any access to the memory by the deallocating function and before any access to the memory by
aligned_alloc. There is a single total order of all allocation and deallocation functions operating on each particular region of memory.
|alignment||-||specifies the alignment. Must be a valid alignment supported by the implementation.|
|size||-|| number of bytes to allocate. An integral multiple of |
 Return value
Either a null pointer or a pointer to the allocated memory. The pointer must be deallocated with free().
size which is not an integral multiple of
alignment or a
alignment which is not valid or not supported by the implementation causes the function to fail and return a null pointer (C11, as published, specified undefined behavior in this case, this was corrected by DR 460).
As an example of the "supported by the implementation" requriement, POSIX function posix_memalign accepts any
alignment that is a power of two and a multiple of
sizeof(void *), and POSIX-based implementations of
aligned_alloc inherit this requirements.
|This section is incomplete|
Reason: no example
- C11 standard (ISO/IEC 9899:2011):
- 184.108.40.206 Memory management functions
 See also
C++ documentation for aligned storage