HomeComputer ScienceBuddy Allocator: Memory Map & Split Tree

Buddy Allocator: Memory Map & Split Tree

Interactive 2D buddy memory allocator: watch a linear memory map and its full binary split/merge tree update live as you request and free power-of-two blocks, drag-to-pan and scroll-to-zoom the tree, resize the pool, and track internal fragmentation in real time.

Computer Science2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-operating-systems-computer-science-2 ↗ Open standalone

The buddy system is the power-of-two memory allocator behind the Linux kernel's page allocator and generations of Unix kmem subsystems before it. This 2D simulator renders a real memory pool two ways at once: a linear memory map showing exactly how the pool is currently partitioned, and the full binary buddy tree beneath it, so you can see precisely which region was split to satisfy a request and which two buddies recombined when you freed a block. Request a chunk of memory and watch the allocator repeatedly halve the smallest sufficient free block; free any allocated block and watch it recursively merge with its buddy — and its buddy's buddy — the instant both sides are free again. Resize the pool itself, toggle a fragmentation heatmap, and drag/zoom the tree to inspect deep splits up close.

⚙ Under the hood

Interactive 2D buddy memory allocator: watch a linear memory map and its full binary split/merge tree update live as you request and free power-of-two blocks, drag-to-pan and scroll-to-zoom the tree, resize the pool, and track internal fragmentation in real time.

operating systemsmemory managementbuddy allocatorkernelalgorithmsfragmentationbinary tree

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)