Mahn Mahn - 8 months ago 72
Node.js Question

What do the return values of node.js process.memoryUsage() stand for?

From the official documentation (source):


Returns an object describing the memory usage of the Node process
measured in bytes.

var util = require('util');


This will generate:

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

heapTotal and heapUsed refer to V8's memory usage.

Exactly what do rss, heapTotal, and heapUsed stand for?

It might seem like a trivial question, but I've been looking and I could not find a clear answer so far.


RSS is the resident set size, the portion of the process's memory held in RAM (as opposed to the swap space or the part held in the filesystem).

The heap is the portion of memory from which newly allocated objects will come from (think of malloc in C, or new in JavaScript).

You can read more about the heap at Wikipedia.