c++ - the memory distribution of nodejs -


when start new nodejs , type process.memoryusage(), shows

> process.memoryusage() { rss: 11296768, heaptotal: 7195904, heapused: 2964776 }

so nodejs uses 11m memory , v8's heap uses 7m of them.

what else consumes remaining 11-7=4m memory, c++ part of nodejs? libuv? v8 itself?

is there methods or tools see memory distribution?

ps: don't need node-heap/node-memwatch detect memory in v8 heap. measuring memory used js project (js files). want know memory used node itself. parts use remaining 4m, , how each part use.

v8 doesn't compact heap every time garbage collector runs. means there may unused space in between. here's lame diagram show may going on under hood.

------------------------------------------- |            |             |              | |   used     |   unused    |      used    | |            |             |              | ------------------------------------------- 

so total heap size first byte allocated last byte allocated. v8 use "unused" space @ point in future, doesn't need to.


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -