最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Does node.js --max-old-space-size include forked processes? - Stack Overflow

programmeradmin2浏览0评论

I'm working on resolving out-of-memory errors in a node.js application and using the --max-old-space-size parameter when launching node to set the size to 4096MB, the maximum accoring to .x-archive/wiki/FAQ (I can't find simular documentation for the current version of node.js).

What I'm wondering is if that 4096MB limit is imposed on everything used by that single node.js script, or if each process is allocated 4096MB?

In other words, if I fork() additional processes from inside the script, does each forked process get 4096MB to work with, or do they all draw from the same 4096MB pool?

I'm working on resolving out-of-memory errors in a node.js application and using the --max-old-space-size parameter when launching node to set the size to 4096MB, the maximum accoring to https://github./nodejs/node-v0.x-archive/wiki/FAQ (I can't find simular documentation for the current version of node.js).

What I'm wondering is if that 4096MB limit is imposed on everything used by that single node.js script, or if each process is allocated 4096MB?

In other words, if I fork() additional processes from inside the script, does each forked process get 4096MB to work with, or do they all draw from the same 4096MB pool?

Share Improve this question asked Sep 23, 2015 at 17:57 jasongullicksonjasongullickson 1,0511 gold badge14 silver badges31 bronze badges 1
  • systemctl status seems to indicate each process gets it's own allocation (tried to paste the example but can't format it here). That said I'd still like some "official" confirmation. – jasongullickson Commented Sep 23, 2015 at 19:25
Add a ment  | 

1 Answer 1

Reset to default 17

My team had the same question and so we tested this on our staging server. We use the native node cluster module with forever as a daemon.

For every forked process, appearing in htop, we can see the --max-old-space-size flag being passed along. Each each child process had the flag, including processes forked later on in the app.

We did NOT need to manually pass the flag through cluster module itself.

In other words, if I fork() additional processes from inside the script, does each forked process get 4096MB to work with, or do they all draw from the same 4096MB pool?

I believe this is the case with the tests that we ran at the time.

发布评论

评论列表(0)

  1. 暂无评论