aligned_alloc
¶ISO C23 specification:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf section 7.24.3.1.
POSIX specification:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/aligned_alloc.html
Documentation:
man aligned_alloc
Portability problems fixed by Gnulib:
sizeof (void *)
on some platforms:
macOS 14, AIX 7.3.1.
aligned_alloc
crashes if the requested size is
not a multiple of the alignment:
AddressSanitizer (gcc 11.2 or clang 13).
Portability problems not fixed by Gnulib:
Gnulib has partial substitutes for aligned_alloc
that do not crash even if the AddressSanitizer bug is present:
alignalloc
provides a portable function
alignalloc
that is a near-substitute for glibc
aligned_alloc
, except that the result must be freed
with alignfree
rather than plain free
.
aligned-malloc
provides functions for
allocating and freeing blocks of suitably aligned memory.
pagealign_alloc
provides a similar API for
allocating and freeing blocks of memory aligned on a system page boundary.