Memory Fragmentation

Cause of OOM.

Overview

Memory fragmentation produces apparent OOM even when the kernel reports free pages. The allocator’s heap is fragmented; large allocations fail despite available memory. Recognising fragmentation as a distinct failure mode is what stops the “just give it more memory” reflex.

The approach

Three habits keep memory fragmentation under control: choose the allocator deliberately, monitor fragmentation as a standing signal, and restart periodically when fragmentation is the dominant failure mode.

Why this compounds

Each correctly-tuned process produces ongoing stability for the lifetime of the deployment. The team learns to recognise fragmentation as a class of failure rather than treating every OOM as a memory shortage.