Skip to main content

MALLOC_THRESHOLD

Constant MALLOC_THRESHOLD 

Source
const MALLOC_THRESHOLD: c_int = _; // 131_072i32
Expand description

The size from which on glibc maps every allocation on its own, which goes back to the kernel once freed, and the free memory at the top of the heap from which on glibc returns it. Both are the defaults of glibc, which raises them to the size of every mapped allocation that gets freed, up to 32 and 64 MiB. After an exec_sync with a large output, up to 16 MiB per pipe which get copied into the response, the allocations of that size would stay in the heap then and keep it resident. Setting them turns that off.