Skip to content
We areTOP 1%

What is the difference between internal and external fragmentation?

EasyConceptMemory Management
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

Fragmentation is free memory that cannot be used. Internal fragmentation is unused space inside an allocated block, because the block handed out is larger than what was requested. External fragmentation happens when the total free memory is enough for a request, but it is split into small, non-adjacent holes, so no single hole is large enough.

  • Internal fragmentation comes from fixed-size units: paging (the last page of a process is partly empty) and fixed partitions.
  • External fragmentation comes from variable-size allocation: segmentation and variable partitions.
  • Compaction fixes external fragmentation by moving processes together so that the holes merge into one block, but it is slow and needs addresses that can be relocated at run time. Paging avoids external fragmentation altogether.
  • Smaller pages reduce internal fragmentation but make page tables larger.

Example: with 4 KB pages, a 13 KB process needs 4 pages (16 KB), so 3 KB is internal fragmentation. With variable partitions, free holes of 30 KB, 20 KB and 40 KB add up to 90 KB, yet a 50 KB process cannot be loaded: that is external fragmentation. Compaction would merge them into one 90 KB hole.

More in Memory Management

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account