Memory Fragmentation Calculator
Estimate memory fragmentation percentage from free memory chunk size distribution.
About Memory Fragmentation Calculator
Memory fragmentation occurs when free memory is scattered in small non-contiguous chunks rather than available in large blocks. The fragmentation index (1 - largest_chunk/total_free) ranges from 0% (all free memory is one chunk) to near 100% (free memory is highly scattered). High fragmentation can cause large contiguous allocations to fail even when total free memory appears sufficient — a common issue affecting HugePages, DMA buffers, and large kernel allocations.
Formula
Fragmentation index
fragmentation% = (1 - largest_free_chunk / total_free_memory) × 100
- C_{max}
- largest contiguous free chunk
- M_{free}
- total free memory
Worked example
With the default values below, Memory Fragmentation Calculator returns Fragmentation Index of 93.75%. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Total Free Memoryminimum 1 MB
- 4,096 MB
- Largest Contiguous Free Chunkminimum 1 MB
- 256 MB
- Requested Allocation Sizeminimum 1 MB
- 512 MB
Results
- Fragmentation Index
- 93.75%
- Can Satisfy Request
- false
- Largest Free Chunk
- 256 MB
- Deficit for Allocation
- 256 MB
Step by step
- 1Fragmentation index= 93.75%
- 2Can satisfy allocation?= No (deficit: 256 MB)
Assumptions and limits
- The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
How do I check memory fragmentation on Linux?
Read /proc/buddyinfo to see the buddy allocator's free page counts at each order (4KB, 8KB, ..., 4MB). Low counts at higher orders indicate fragmentation. Also check /proc/pagetypeinfo for more detail.
How does the kernel handle fragmentation?
Linux uses memory compaction (moving pages to create contiguous free space) and reclaim (freeing cached pages) to satisfy large allocations. You can trigger compaction manually via 'echo 1 > /proc/sys/vm/compact_memory'.
