Topic

Garbage Collection & Memory Management

Roots, mark-and-sweep, generational GC, incremental & concurrent passes, write barriers, and fragmentation.

gcmemoryheap

HTML

sample
<div id="heap">Heap graph</div>

CSS

sample
#heap { min-height: 120px; }

JavaScript

sample
const store = []; for (let i=0;i<2000;i++) store.push({i});

Visualizer

Garbage Collection

Generational GC and promotions.

Visualizer

Garbage Collection

Generational GC keeps nursery small, promotes survivors, and occasionally runs full mark-sweep.

live

Controls

Heap size: 5 KB

Visualization

obj-1

Gen: nursery · Size: 1 KB

obj-2

Gen: old · Size: 4 KB

Why this matters

Connect the dots between specs (HTML, CSS, WebIDL) and engine behaviors (parser, layout, GPU). Use the sandbox to reproduce each step with your own snippets.