Understanding Node.js Garbage Collection
summary
Explains that Node.js uses V8 GC and shows concrete behavior: V8 runs a generational GC with a scavenger (minor GC) copying collector for short-lived objects and a mark-sweep-compact major GC for old objects, uses write barriers for concurrent marking, and runs mostly concurrently but sometimes stops the world. Live demo allocates 1,000,000 objects: when references are dropped memory peaks ~7.5MB then settles ~12MB with no major GC; when references are retained it ends at ~99MB and a mark-compact step reduces 47MB to 37MB.
AI-written summary · about
chapters (12)
- 0:00Introduction to talk
- 0:42V8 garbage collector basics
- 3:51Memory leaks explained
- 6:25Stop the world GC impact
- 9:43Generational garbage collection
- 11:08V8 GC optimizations
- 13:16Scavenger minor GC
- 16:31Major GC Mark-Sweep-Compact
- 19:21GC execution flow
- 19:45Live demo setup
- 21:10Demo memory leak impact
- 22:34Key takeaways
related talks
38mUnderstanding Memory Behavior on Nodejs
24mTrash Talk - Understanding Memory Management
09mNodejs Runtime Performance Tips
28mMemory Profiling for Mere Mortals
57mTroubleshooting Node.js Applications Under the Hood
24mYou Did What? Understanding Node.js Optimizations
24mDemystifying Memory Leaks in JavaScript
46mTracking Down a Memory Leak
