JavaScript memory management: Visual Guide
summary
Covers how V8 lays out memory: V8 heap layout with stack vs heap, young (1–8MB) and old generations, and the claim that roughly 20% of objects survive promotion. Explains allocation details, string interning, shallow vs deep copying, and shows how to inspect with Chrome DevTools heap snapshot. Describes garbage collectors: scavenger (minor GC) that copies from-space to to-space, and a parallel mark‑sweep‑compact major GC (compaction and free‑list management, up to seven worker threads, short stop‑the‑world pauses).
AI-written summary · about
chapters (18)
- 0:00JavaScript memory
- 1:06Binary data storage
- 2:30RAM architecture
- 4:56Virtual memory role
- 6:43JS engine memory
- 8:29V8 memory types
- 11:41String interning pointers
- 13:26Objects by reference
- 16:58Immutability pitfalls
- 17:40Garbage collection basics
- 19:46V8 GC algorithm
- 21:51Stop-the-world minor GC
- 23:14Generational hypothesis
- 24:41Old generation mark sweep
- 26:52Memory compaction
- 28:58Major GC steps
- 29:40V8 memory recap
- 31:04Q&A
related talks
22mThe Hitchhiker's Guide to All Things Memory in JS
27mVisualised guide to memory management in JavaScript
26mThe Hitchhiker's Guide to All Things Memory in Javascript
21mMemory: Don't Forget to Take Out the Garbage
17mAlice's Adventures in Memory Management, or how JavaScript objects work
28mAlice's Adventures in Memoryland
24mTrash Talk - Understanding Memory Management
38mUnderstanding Memory Behavior on Nodejs
