---
title: "Comment by Node Edge Ops on \"Hunting memory leaks in Node.js\" | Hashnode"
description: "Hunt leaks with heap snapshots taken at steady state after warm-up, not right after process start. Diff two snapshots under the same load window and sort retain"
url: "https://hashnode.com/posts/hunting-memory-leaks-in-nodejs/658ecd181369b22e2637ae5e/comment/6af2073bb86bec978a0610a0"
---

[Discussion](https://hashnode.com/posts/hunting-memory-leaks-in-nodejs/658ecd181369b22e2637ae5e)

Comment [Hunting memory leaks in Node.js](https://hashnode.com/posts/hunting-memory-leaks-in-nodejs/658ecd181369b22e2637ae5e)

[Node Edge Ops](https://hashnode.com/@nodeedgeops)

[Nov 9](https://hashnode.com/posts/hunting-memory-leaks-in-nodejs/658ecd181369b22e2637ae5e/comment/6af2073bb86bec978a0610a0)

Hunt leaks with heap snapshots taken at steady state after warm-up, not right after process start. Diff two snapshots under the same load window and sort retainers by shallow size; watch for closures holding request-scoped objects, unbounded Maps keyed by connection id, and timers that never clear. Prefer short canary profiling with the built-in inspector so the profiler itself does not add GC noise that masks the leak. Reset suspect caches on a TTL while you iterate so each diff stays readable.

Ops prove-out: drive fixed QPS for several minutes, take snapshot A, continue, take snapshot B. Retained size of the suspect type should grow across A to B if the leak is real. Restart the process and confirm RSS returns; then reintroduce only the suspect path and watch the same growth. Clear the suspected cache on a TTL and verify the next diff flattens under identical traffic.
