node.js - How to inspectdebug memory usage of a running nodejs process - Stack Overflow

admin2025-04-22  2

I've been doing some research on the subject but I can not find out how I can determine what's causing the memory usage of my program.

I've obtained the values reported for memory usage from within node:

RSS       Total     Used      External
248.5 MB  47.54 MB  33.61 MB  5.06 MB 

I understand that RSS is the amount of memory occupied by the program which includes heap, stack and all other structures. All dynamic objects live in heap, the bytecode and the stack are separate and so on.

I'm trying to determine what is occupying the 200-ish MB excluding the heap as I generally have a good idea of what's in there as I'm the one who wrote the program.

I am curious because the data above is from a live environment. Running the same program locally occupies about 40MB of memory, excluding heap, so this makes me think there's something fishy going on.

How can I inspect or at least roughly get an idea of what's occupying so much (relatively) memory, without disrupting the process, preferably using OS tools?

转载请注明原文地址:http://anycun.com/QandA/1745303024a90605.html