I'm running my Node JS process through forever as below:
sudo forever start -o out.log -e error.log myServer.js
I want to change the memory limit of my NodeJs server as I do like below when I'm running it purely with node.
node --max-old-space-size=512 myServer.js
How I can do the same when I'm running it with forever? Is there some way like 'forever start --max-old-space-size=512'
If you want to increase the max memory for Node you can use --max_old_space_size option. You should set this with NODE_OPTIONS environment variable.
js application locally after closing the terminal or Application, to run the nodeJS application permanently. We use NPM modules such as forever or PM2 to ensure that a given script runs continuously. NPM is a Default Package manager for Node.
By default, Node. js (up to 11. x ) uses a maximum heap size of 700MB and 1400MB on 32-bit and 64-bit platforms, respectively.
Node has a default max memory usage of less than 2GB on some 64bit systems (depending on the Node runtime version). This can cause unexpected memory issues when running on CircleCI. It's possible to adjust the max memory ceiling using a command-line flag passed into Node: --max-old-space-size=<memory in MB>
You can pass node options by changing the command (which defaults to "node").
So for example:
sudo forever start -c "node --max_old_space_size=512" -o out.log -e error.log myServer.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With