Node.js Memory Leak: Two Weeks to Find One Missing removeListener()
Our Node.js API was restarting every 6 hours due to memory leaks. Took me two weeks to find the bug. It was a single missing removeListener() call. Here’s how I found it, and what I learned about debugging Node memory leaks that actually works. The symptom Memory usage graph looked like this: Memory │ ╱╱╱╱ │ ╱╱ │ ╱╱ └────────────> Time Classic memory leak pattern. Process starts at 200MB, grows to 2GB over 6 hours, then OOM kills it. Kubernetes restarts it. Repeat. ...