TMP_INIT, TMP_START, TMP_ALLOC, TMP_ARRAY_ALLOC, TMP_END
#include <flint/flint.h>TMP_INITsourceTMP_STARTsourceTMP_ALLOC(size)sourceTMP_ARRAY_ALLOC(n, T)sourceTMP_ENDsourceTemporary allocation within one function. TMP_INIT goes with the variable declarations and TMP_START before the first TMP_ALLOC. TMP_ALLOC(size) returns size bytes, taken from the stack with alloca if size is at most 8192 and from flint_malloc otherwise; TMP_ARRAY_ALLOC(n, T) returns an array of n objects of type T. TMP_END frees all blocks obtained since TMP_START.
With assertions enabled, all blocks come from flint_malloc, so that memory checkers see them. Each TMP_ALLOC uses a little stack space even for large blocks, and stack blocks are only released when the function returns, so do not use TMP_ALLOC in a loop or in a recursive function with unbounded depth. The guide Memory management has an example.
The FLINT team, “TMP_INIT, TMP_START, TMP_ALLOC, TMP_ARRAY_ALLOC, TMP_END (flint.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/flint/TMP_INIT.html (generated 2026-10-20).
@misc{flint-doc-flint-TMP-INIT,
author = {{The FLINT team}},
title = {{TMP\_INIT, TMP\_START, TMP\_ALLOC, TMP\_ARRAY\_ALLOC, TMP\_END (flint.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/flint/TMP_INIT.html},
note = {Generated 2026-10-20}
}