Understanding Memory Behavior on Nodejs
summary
Covers how V8 allocates and promotes objects (young → old generation after roughly 5–10 scavenge cycles), shows a reproducible leaking server that repeatedly pushes objects into an array and leaks via closures and unnamed functions, and demonstrates debugging with node --inspect, Chrome DevTools heap snapshots and process.memoryUsage to spot resident size, heapTotal/heapUsed and external C++ allocations. Notes stop‑the‑world GC pauses, explains generational GC behavior, warns node-memwatch is unmaintained, and includes real globo.com incident examples.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 2:44Why memory matters
- 3:25Node.js and V8 basics
- 8:23Garbage collection explained
- 13:52Memory limits and pauses
- 17:58Memory segments in Node.js
- 19:05Generational garbage collection
- 21:11Memory allocation in Node.js
- 24:07Object properties and cycles
- 25:54Debugging memory leaks
- 30:18Tools for leak detection
- 32:48Server memory leaks
- 35:19Closure leaks
- 36:22Summary and takeaways
related talks
24mTrash Talk - Understanding Memory Management
22mThe Hitchhiker's Guide to All Things Memory in JS
31mJavaScript memory management: Visual Guide
23mUnderstanding Node.js Garbage Collection
26mThe Hitchhiker's Guide to All Things Memory in Javascript
35mMemory Chronicles: Manage, Trace and Fix Memory Leaks
23mWarp Speed Memory Management
21mMemory: Don't Forget to Take Out the Garbage
