Finding memory leaks and CPU bottlenecks with Node.js debug tools
summary
Walks through connecting Node.js to Chrome DevTools with --inspect or sending kill -USR1 to an already running PID, and using SSH port forwarding to debug a Heroku dyno. Takes heap snapshot comparisons with Chrome’s Memory panel (heap grows from ~70MB to ~170MB, ~2,088 new IncomingMessage objects) to find requests stored in a forgotten map; uses CPU profiler to show a regex consuming ~10s of CPU on the call stack. Demos work end-to-end and produce actionable fixes: stop retaining req/res objects and replace or sandbox the long-running regex.
AI-written summary · about
chapters (6)
- 0:00Introduction
- 3:43Connecting to V8
- 11:28Remote debugging demo
- 20:15Memory leak analysis
- 32:07CPU bottleneck analysis
- 38:04Best practices and wrap-up
related talks
50mDebugging Node.js in Production
38mWelcome to Mordor! Hunting Performance Issues in Node.js.
50mPost-Mortem Debugging in Node.js
39mWelcome to Mordor! Hunting Performance Issues in Node js
28mPost mortem NodeJS debugging
46mTracking Down a Memory Leak
24mDemystifying Memory Leaks in JavaScript
35mMemory Chronicles: Manage, Trace and Fix Memory Leaks
