v8-memoryAnswer last reviewed July 2026

Say process.memoryUsage() shows heapUsed at 200MB but RSS is sitting at 1.5GB. Where did all that memory go, and how would you find out?

Good answers map every process.memoryUsage() field to its allocator, know Buffer bytes live outside the V8 heap, and can explain slab retention and slack

What an AI-prepared candidate might say

So Buffers in Node get allocated outside the V8 heap, which means heapUsed doesn't include them. process.memoryUsage() breaks the total into a few fields. heapTotal and heapUsed cover V8's managed heap. external is memory tied to JS objects but allocated in C++, which includes Buffers, and arrayBuffers is the portion belonging to ArrayBuffers and Buffers specifically. rss is the total resident memory of the whole process. A gap like 200MB of heap against 1.5GB of RSS usually means heavy Buffer usage, file or network data being held in memory, or maybe memory used by native addons. First step is reading the external and arrayBuffers fields. If they're large, the memory is in Buffers, and then you go look for code retaining them, like caching file contents or accumulating socket data somewhere.

Senior
Locked

The full RSS ledger walked field by field, how Buffer pooling and slab retention really work, and why a 10-byte slice can pin an entire 64KiB allocation.

Unlock the depth
Staff
Locked

The slice-retention incident that keeps hitting proxies, the glibc arena behavior that holds RSS at peak long after a spike, and MALLOC_ARENA_MAX as the container fix.

Unlock the depth
Follow-up chain
Say process.memoryUsage() shows heapUsed at 200MB but RSS is sitting at 1.5GB. Where did all that memory go, and how would you find out? | NodeBook