Managing free space

Four ways to choose a free chunk, and two allocators built for speed, following the Free-Space Management chapter of OSTEP. Each scenario plays step by step, and you can type your own sequence of requests.

Strategy


  

Heap

100 bytes. A, B and C belong to other code. Headers are ignored to keep the numbers simple.

▼ checking
▲ rover
  • Free
  • In use by other code
  • Given to a request (r1, r2, …)

Free list

Kept in address order. Each chunk is written as size@address.

First fit

The search the allocator runs.

Same operations, all four strategies

Keyboard: ← → to step, Space to play or pause.