T
T
Test2017-07-10 18:31:29
Node.js
Test, 2017-07-10 18:31:29

How to work with process.memoryUsage()?

process.memoryUsage() in Node.js returns an object:

{
  rss: 4935680,
  heapTotal: 1826816,
  heapUsed: 650472,
  external: 49879
}

All these values, as I understand it, are related to RAM and are written in bytes. Can you explain what values ​​\u200b\u200bare responsible for what and what should be divided by what to get the percentage of occupied RAM?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mrDataStream777, 2020-05-15
@mrDataStream777

https://nodejs.org/api/process.html
heapTotal and heapUsed refer to V8's memory usage.
external refers to the memory usage of C++ objects bound to JavaScript objects managed by V8.
rss, Resident Set Size, is the amount of space occupied in the main memory device (that is a subset of the total allocated memory) for the process, including all C++ and JavaScript objects and code.
arrayBuffers refers to memory allocated for ArrayBuffers and SharedArrayBuffers, including all Node.js Buffers. This is also included in the external value. When Node.js is used as an embedded library, this value may be 0 because allocations for ArrayBuffers may not be tracked in that case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question