question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Heap used reports "Resident Set Size" instead of "Used Heap" size when profiling Node.js

See original GitHub issue

Hey 👋 We’ve recently been using this vscode extension to capture and investigate performance profiles while working on Next.js, this is mostly focused on CPU profiling. Today I was having a look at some memory leak reports and realized memory usage was growing uncontrollably up to 1GB in the debugger chart while the Chrome devtools debugger kept saying only 54MB was allocated.

When looking at process.memoryUsage() I realized that the extension reports the process.memoryUsage().rss instead of process.memoryUsage().heapUsed which Chrome reports. Below the chart it is labeled as “Heap used” though.

My main question is if this is a mistake or intentional? Happy to send a PR to update the label or measurement.

(just for my own future reference) In looking at the issue I found this article that goes in-depth on the differences between the metrics reported https://www.dynatrace.com/news/blog/understanding-garbage-collection-and-hunting-memory-leaks-in-node-js/

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
connor4312commented, Jan 26, 2022

Yes, a change to heapUsed would be good. Thanks for linking the article, it’s quite helpful, especially this diagram:

image

0reactions
timneutkenscommented, Jan 31, 2022

Thanks for landing this @connor4312 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js process rss keeps rising when heapUsed/heapTotal ...
js is the only process on the server consuming significant resources, I assumed a growing rss was due to no demand for memory...
Read more >
Understanding memory leaks in Node.js apps - LogRocket Blog
rss , or resident set size, refers to the amount of space occupied in the main memory for the process, which includes code...
Read more >
Understanding Node.js Resident Set Size vs. Heap Size ...
My assumption is that, for some reason, this means the toObject() function moved the leaked data from RSS into the heap, so not...
Read more >
How to Find, Fix, and Prevent Node.js Memory Leaks
rss : refers to resident set size. It calculates the total amount of space occupied in the main memory. It includes heap, stack,...
Read more >
Understanding Garbage Collection and Hunting Memory ...
Resident set size. Total size of the heap. Heap actually used. We can use this function to record the memory usage over time...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found