Menu

Post image 1
Post image 2
1 / 2
0

Why your Node.js memory keeps climbing in production (and how to find the leak)

DEV Community·Alan West·18 days ago
#pZuSp0BB
Reading 0:00
15s threshold

The 3 AM page nobody wants Last month I got woken up by PagerDuty at some ungodly hour because one of our Node services was eating memory like it owed us money. Restart, it goes back to 200MB. Two hours later, 1.4GB. Restart. Repeat. You know the drill. I've debugged this exact pattern across maybe a dozen Node projects now, and the root cause is almost never what you'd expect. So let's walk through how to actually find the leak instead of just bumping your container memory limit and calling it a day (which, yes, I have absolutely done before). What a real memory leak looks like First, a quick sanity check. Memory growing isn't always a leak. V8 is lazy about garbage collection — it'll happily let your heap grow if there's no pressure. A real leak looks like this: Memory grows steadily under load It doesn't drop after GC pauses It survives traffic dips Restarting fixes it (temporarily) If your memory just plateaus high but stops climbing, you probably don't have a leak — you have a hungry workload.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More