From bc4086867258f2956cbe0343a0f572fbbc7edf07 Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Fri, 11 Jul 2025 10:07:44 +0800 Subject: [PATCH 1/5] doc: add rss leak note on process memoryUsage --- doc/api/process.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/api/process.md b/doc/api/process.md index 9182d25219c92f..e7a04cc7986e44 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -2807,6 +2807,11 @@ The `process.memoryUsage()` method iterates over each page to gather information about memory usage which might be slow depending on the program memory allocations. +### A note on process memoryUsage + +Once you notice that the `rss` continues to rise while the `heapTotal` shows normal, and the `rss` is more than three times higher than the `heapTotal`, it is very likely that there is an issue with an external memory leak. +Referer to the discussions in [nodejs/node#21973](https://github.com/nodejs/node/issues/21973) and [nodejs/help#1942](https://github.com/nodejs/help/issues/1942) for suggestions on switching the system's default `malloc` to `jemalloc` to try to resolve such issues. + ## `process.memoryUsage.rss()`