Open ghost opened 1 year ago
Although the rest of your process continues to consume a large amount of memory it does look like your RSS object is being garbage collected with a large amount of memory freed between 22 and 32 seconds.
Thank you for your response! I specifically posted this snippet to show how the RSS gets collected but the heapTotal and heapUsed remain stable. It is my understanding that the RSS should be always larger and that it includes the heap. I have not been able to find any material online where the RSS is smaller.
It is my understanding that the RSS should be always larger and that it includes the heap
this is not necessarily true. RSS is the amount of actual memory paged into the process. When there is a memory demand from other processes, OS temporarily steals
pages from your process (to get back later when it actually needs it). So RSS can be (and will be in many cases) lesser than the virtual memory. On the other hand, the virtual memory (heapTotal / heapUsed) represents the total allocated and total occupied memory respectively. (occupation does not imply active usage).
So I will deem no issues with your metrics. You will need to worry if and when the heapTotal keeps growing in response to running of your workload.
Hope this helps.
what does heapTotal represent?
what does heapTotal represent?
total Javascript heap size.
Hi, I’m experiencing this issue’s opposite (kinda), I see a gradual (day by day and few MBs) increase of process.rss but process.healTotal remains stable, does that implicitly mean a memory leak? Should I be worried?
It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.
Details
I am running an express server. We have a memory leak and I am trying to investigate it. It has been narrowed down to a specific function. To get an idea of how much memory the process is using I am using the default
process.memoryUsage()
provided by node. I am appending every 10 seconds to a file the formatted results of this method call. I am interested if after making N amount of calls to observe how the memory behaves, how long it takes for the garbage collector to clean up and so on. However, surprisingly I am seeing that therss
goes down but theheapTotal
andheapUsed
remain higher. I cannot find any other such cases. The behaviour remained in all of the runs I did.I am attaching a snapshot of the findings:
Node.js version
v18.14.1
Example code
I cannot provide code since it is a large application.
Operating system
macOS
Scope
runtime
Module and version
Not applicable.