"Leak Hunting Finding and debugging a memory leak in Node.js"
summary
A Node.js example deliberately stores every request in an array, causing RAM to climb to ~7.8 GB and not drop when traffic stops; heap snapshots show retained request objects and closures preventing GC. The workflow uses Chrome DevTools heap snapshots (via --inspect / heapdump) to compare allocations, find the exact retained paths, and confirm fixes. Practical fixes include removing global references, closing connections, and reproducing the leak in test to validate the patch.
AI-written summary · about
chapters (10)
- 0:00Introduction to memory leaks
- 3:21Why memory leaks matter in Node.js
- 6:43Common causes of memory leaks
- 8:10Impact on performance and stability
- 10:45Debugging strategies and tools
- 12:31Live leak demonstration
- 16:52Analyzing the leak with DevTools
- 20:39Fixing the leak in code
- 24:14Prevention and best practices
- 27:01Q&A and closing
