v8 total heap size of application grows to 1.4 GB while heap usage is only 300 MB

168 views
Skip to first unread message

Alexander Overvoorde

unread,
Mar 28, 2014, 8:11:10 AM3/28/14
to nod...@googlegroups.com
Hi,

I'm working on a Socket.IO server and I've noticed that after a couple hours, the memory usage of the process starts growing from ~500 MB to the maximum of 1.4 GB. When I inspect the memory usage with heapdump, the size of the heap dump is only around 317 MB and everything looks like it should. When I use process.memoryUsage(), I get the following result:

{
  "rss": 1595502592,
  "heapTotal": 1418914872,
  "heapUsed": 326959512
}

What could be happening that makes the v8 heap size grow so large? It's not in the heapdump, so it seems to me that it can't be a memory leak in my code.

Trevor Norris

unread,
Mar 29, 2014, 11:21:08 AM3/29/14
to nod...@googlegroups.com
V8 allows itself to use up to 1.4 GB of memory, and is very lazy about compacting it's usage of that memory. This allows for better performance. So what you're seeing isn't unexpected.

Vladimir Li

unread,
May 8, 2015, 9:46:42 AM5/8/15
to nod...@googlegroups.com
How can I limit it to 512MB for example? I tried --max_old_space_size, but it doesn't work

суббота, 29 марта 2014 г., 21:21:08 UTC+6 пользователь Trevor Norris написал:
Reply all
Reply to author
Forward
0 new messages