+89
−7
+41
−6
+5
−0
+4
−0
Loading
Aligning a fresh mapping to a pageSize boundary costs up to two munmap calls for the trimmed-off ends, so a cold allocator paid roughly three syscalls per 64 KiB slab region. When a single pageSize region is needed and the pool is empty, acquire slabBatch of them in one mapping and put the rest into the pool: three syscalls amortized over sixteen regions, and the pooled remainder immediately serves the other size classes, which all share the pageSize region class. Unix only: VirtualFree with MEM_RELEASE frees only whole VirtualAlloc allocations, never a sub-range, so on Windows a carved region could not be returned individually (canCarve). This trims the mapping churn of a cold or recently Trimmed allocator - a process that touches eleven size classes now issues one mmap instead of eleven mmaps and up to twenty-two trim munmaps. Steady-state throughput of long benchmark runs is unchanged: once the pool is warm, fresh mappings are rare either way. TestTrim and TestTrimClasses asserted exactly one mapping per class and now assert stability of the mapping count while cycling, plus the batch-rounded count; TestSlabBatch covers the batch acquisition itself.