Process

process.memoryUsage()

Reports byte counts including RSS, heapTotal, heapUsed, external and arrayBuffers. RSS is resident process memory, not JavaScript heap alone. Inspect trends rather than interpreting one sample as a leak. Tested on Node.js 22.16.0. Example output (one line per entry): ["true"].

Formal Syntax & Structure

nodejs syntaxnodejs
process.memoryUsage()

Return Value

object

Memory counters in bytes.

Working Example

Example Snippetnodejs
const m = process.memoryUsage();console.log(['rss', 'heapTotal', 'heapUsed', 'external', 'arrayBuffers'].every(k => Number.isFinite(m[k]) && m[k] >= 0));
Node.js Reference