Trash Talk - Understanding Memory Management
summary
Explains how Node.js and Google's V8 manage memory with a mark-and-sweep garbage collector that uses the generational hypothesis (frequent collection of short‑lived objects, promotion of survivors), contrasts that with reference counting and its cycle problem, and shows common leaks: accidental globals, closures holding large arrays, long‑running timers, and detached DOM nodes. Demonstrates diagnosis with heap snapshots in Chrome DevTools, and fixes using WeakMap/WeakSet and FinalizationRegistry plus deterministic cleanup.
AI-written summary · about
chapters (11)
- 0:00Introduction to talk
- 0:24Garbage collection basics
- 2:52Memory life cycle stages
- 7:07Undecidable problems in GC
- 9:56Reference counting vs mark-sweep
- 12:27V8 garbage collection
- 15:20Common memory leaks
- 18:55Heap snapshots for debugging
- 20:19Weak maps and sets
- 22:47Finalization registry
- 23:10Best practices summary
related talks
38mUnderstanding Memory Behavior on Nodejs
31mJavaScript memory management: Visual Guide
21mMemory: Don't Forget to Take Out the Garbage
22mThe Hitchhiker's Guide to All Things Memory in JS
23mUnderstanding Node.js Garbage Collection
30mMemory Don't Forget To Take Out The Garbage
27mVisualised guide to memory management in JavaScript
26mThe Hitchhiker's Guide to All Things Memory in Javascript
