In Node.js, what does
process.memoryUsage().heapUsed represent?- aThe total memory (RSS) the Node.js process occupies in the operating system, including buffers and native code
- bThe maximum heap size Node.js is allowed to ever use, set by the
--max-old-space-sizeflag - cThe amount of memory currently used by objects living on the V8 JavaScript heap✓
- dThe amount of memory freed by the last garbage collection cycle
Explanation:
heapUsed reports the bytes currently occupied on V8's JavaScript heap at the moment the call is made — mostly live objects, though it can also include garbage not yet reclaimed by the next collection cycle. It is distinct from rss (the whole process's resident memory, including native buffers and code), heapTotal (memory V8 has allocated for the heap, whether used or not), and it is not a delta produced by garbage collection.