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
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.