Skip to main content

MAX_SMALL

Constant MAX_SMALL 

Source
pub const MAX_SMALL: usize = 32_768;
Expand description

The largest allocation served by a size class. Above this, requests are mapped directly and returned with unmap.

Raised 8 KiB → 32 KiB by the M1 decomposition. The old cap assumed large allocations were infrequent — and under a cross-shard load the dispatch and reply buffers sit just past 8 KiB, so every one paid an mmap on birth and a munmap on death, eight shards serialised on the process-wide mmap_lock: 40 % of server self time was __x64_sys_munmap + vm_mmap_pgoff (finding measured (the mmap-lock convoy finding). glibc recycles those buffers from its arena with zero syscalls, which is the entire cross-shard gap. A 64 KiB span still holds 2–8 slots at these sizes.