Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.JS - any side effects of setting max-old-space-size too large?

Our server runs Node.JS on a cloud PaaS (specifically Bluemix). We can configure the amount of allocated memory through the PaaS dashboard, but I noticed that for values above ~1.4GB you also need to execute node with the --max-old-space-size option (explanation here).

This means that whenever I want to change the size of allocated memory, I have to change it in two places in the settings.

What would happen if I call node --max-old-space-size 99999999999 app.js? Will Node.JS try to allocate 99999999999MB, or will it consider the actual memory-limit of the VM\Container in which it runs? Does it affect the behavior of the GC (i.e. if it looks like there is a lot of free space, the GC will run less times)? Is there a --max-old-space-size use-machine-limits option?

Thanks

like image 961
Oren Avatar asked Apr 07 '16 14:04

Oren


1 Answers

What would happen if I call node --max-old-space-size 99999999999 app.js? Will Node.JS try to allocate 99999999999MB, or will it consider the actual memory-limit of the VM\Container in which it runs?

Node will not allocate the said memory, but it will attempt to, in response to growing memory demand, if that happens, in the application - incrementally, in reasonably small chunks.

Does it affect the behavior of the GC (i.e. if it looks like there is a lot of free space, the GC will run less times)?

Yes, the tenure space can contain lot of garbage, and the de-allocation will be less frequent.

Is there a --max-old-space-size use-machine-limits option?

Honestly, I don’t know - but will research on this, and update here, if I get information on this.

Hope this helps.

like image 155
Gireesh Punathil Avatar answered Oct 13 '22 11:10

Gireesh Punathil