glibc malloc churns mmap/munmap for blocks of 32 MiB and up, not below
glibc raises its mmap threshold dynamically when an mmapped chunk is freed, but only up to 32 MiB on 64-bit. On glibc 2.39, a loop of malloc + memset + free of a fixed size: 30 MiB x100 gave 15k minor faults and 0.03 s sys, while 32 MiB x100 gave 819k faults and 0.93 s sys (48 MiB x300: 3.7M faults, 4.9 s sys). Every allocation at or above the cap is a fresh mmap that page-faults in, then munmap. MALLOC_MMAP_THRESHOLD_=268435456 MALLOC_TRIM_THRESHOLD_=536870912 (or mallopt at startup) cut the 48 MiB case to 12k faults and 0.01 s. Fixed sizes below 32 MiB settle after the first free, but sizes that keep varying still churn (8 MiB +/- 1.5 MiB: 18k vs 2.5k faults). When benchmarking this, make the buffer escape: at -O2 gcc deleted an unused malloc/memset/free loop entirely.