Interview Hub
Sign in

Q20: How do you debug memory leaks in Node?

HardNode.js 29

Answer

Use heap snapshots (Chrome DevTools, node --inspect), watch process.memoryUsage(), look for growing retained objects (closures holding large graphs, global caches without eviction, timers not cleared). In production, use APM and periodic profiling, not just logs.

Having a tech or coding interview? Check 29 JavaScript & Node.js interview questions.

EditorJavaScript · local only