Allocators, fragmentation and OOM
medium 7 minAn allocator subdivides pages into objects and retains free space for reuse.
Where it shows up
The same pattern appears across everyday software.
Live objects fall but RSS stays high
A batch worker doubles its resident footprint after a change to allocation sizes. Compare a live-object profile just after equivalent batches, allocator statistics and cgroup anonymous memory. A stable live heap alongside growing slack suggests fragmentation or cached arenas. Raising the memory limit buys time but does not distinguish retention from allocator behavior.
Verifying the intervention
Group similar lifetimes or bound arenas. Check retained memory and allocation latency over several batches. A growing reachable object graph after equivalent batches calls for object lifetime analysis before allocator tuning.