Reputation: 1
When I start a new nodejs and type process.memoryUsage(), it shows
> process.memoryUsage()
{ rss: 11296768,
heapTotal: 7195904,
heapUsed: 2964776 }
so the nodejs uses the 11M memory and v8's heap uses 7M of them.
What else consumes the remaining 11-7=4M memory, the c++ part of nodejs? libuv? v8 itself?
Is there any methods or tools to see the memory distribution?
ps: I don't need node-heap/node-memwatch to detect the memory in v8 heap. They are mainly measuring the memory used by js project (js files). I want to know the memory used by node itself. Which parts use the remaining 4M, and how much does each part use.
Upvotes: 0
Views: 97
Reputation: 21079
V8 doesn't compact the heap every time the garbage collector runs. Which means there may be unused space in between. Here's a really lame diagram to show what may be going on under the hood.
-------------------------------------------
| | | |
| used | unused | used |
| | | |
-------------------------------------------
So the total heap size is the first byte allocated to the last byte allocated. V8 will probably use the "unused" space at some point in the future, but it doesn't need to.
Upvotes: 1