mpn_ctx_fit_buffer
#include <flint/fft_small.h>Returns at least n bytes of scratch memory from the context, aligned to 4096 bytes. The memory belongs to the context and must not be freed. A later call may move the buffer, so the pointer is valid only until the next call on R, and only one request can be outstanding.
The buffer grows geometrically (by at least 1/16) and is kept until mpn_ctx_clear, so repeated multiplications on the same thread allocate nothing. While a reservation made with mpn_ctx_fit_buffer_reserve is live, requests of at most the reserved head size are served from the buffer, and larger ones from a second buffer in the context with the same rules.
The FLINT team, “mpn_ctx_fit_buffer (fft_small.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fft_small/mpn_ctx_fit_buffer.html (generated 2026-10-20).
@misc{flint-doc-fft-small-mpn-ctx-fit-buffer,
author = {{The FLINT team}},
title = {{mpn\_ctx\_fit\_buffer (fft\_small.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/fft_small/mpn_ctx_fit_buffer.html},
note = {Generated 2026-10-20}
}