How Can I Increase the Max Memory for Node?

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>


The flag can be difficult to ensure that it is being used, especially when node processes are forked. The best way to ensure this setting will be picked up by all node processes within the environment is to apply this setting directly to an environment variable, which can be done using Node. 8 or higher:



Note: If you have specified export NODE_OPTIONS=<value> in your package.json, it'll override what you set in the NODE_OPTIONS environment variable in the config.yml (either at the container, job, or step respective level)


Further Reading:

Was this article helpful?
52 out of 136 found this helpful



Article is closed for comments.