flint_aligned_alloc, flint_aligned_free
#include <flint/flint.h>void * flint_aligned_alloc(size_t alignment, size_t size)sourcevoid flint_aligned_free(void * ptr)sourceflint_aligned_alloc allocates size bytes at an address that is a multiple of alignment, which must be a power of two and at least sizeof(ulong); size must be a multiple of alignment (checked only with assertions enabled). Throws on failure. The block must be freed with flint_aligned_free.
By default these use aligned_alloc and free (or _aligned_malloc and _aligned_free on Windows). Where neither is available, and whenever custom memory functions have been installed with __flint_set_memory_functions, they over-allocate with flint_malloc and store the offset of the aligned address in front of it.
The FLINT team, “flint_aligned_alloc, flint_aligned_free (flint.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/flint/flint_aligned_alloc.html (generated 2026-10-20).
@misc{flint-doc-flint-flint-aligned-alloc,
author = {{The FLINT team}},
title = {{flint\_aligned\_alloc, flint\_aligned\_free (flint.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/flint/flint_aligned_alloc.html},
note = {Generated 2026-10-20}
}