Skip to content

Build a Memory Allocator

Build malloc/free from scratch: bump allocator, free lists, splitting and coalescing, size classes, thread-local caches. By the end you'll understand what every allocator (jemalloc, tcmalloc, ptmalloc) actually does.

intermediate14 lessons4 chapters14 graded exercisesPython

No sign-up needed for lesson 1 · certificate on completion · sign up to save progress

What you’ll have built

Chapter by chapter. Every step is a graded exercise.

  • Foundations
  • Free Lists
  • Optimizations
  • Production
Starts in Python — solve in the language you choose in the editor, same tests either way.

Curriculum

4 chapters, 14 lessons. Each lesson is a short read, one graded exercise, and a quiz.

  1. 1Why Build an Allocator?Read · exercise · quiz
  2. 2Heap LayoutRead · exercise · quiz
Loading reference solution…