Also Some really good notes from CS241E, see Heap (Memory).

Adding on to this with notes from SE350, which makes the distinction between internal and external fragmentation.

To understand fragmentation, you must first understand Memory Partitioning.

Internal fragmentation is when the memory internal to a partition becomes fragmented.

  • Caused by when the block of data allocated is smaller than the partition
  • Ex: when you use a Fixed Partitioning scheme, there may be a 2MB program occupying a a 8MB partition

External fragmentation when the memory that is external to all partitions becomes increasingly fragmented.

  • In Dynamic Partitioning schemes when you allocate and deallocate and there are holes that start to creep in