How do you find a memory leak in a Node app?

Node.js testing, performance and deployment · Experienced

Model answer

Watch memory over time (process.memoryUsage, monitoring), take heap snapshots with Chrome DevTools or node --inspect and compare them, and look for growing objects. Common causes: global caches without limits, listeners never removed, timers never cleared, and closures holding large data. Fix, then verify memory stays flat under load.

Learn this topic

Deploy a MERN App to a VPS with pm2, nginx and HTTPS (Let's Encrypt) in the course MERN Stack Full Course: MongoDB, Express, React and Node.js.

Sign in to add your own answer.

More questions