Default Memory Size
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>
How to Increase Memory Size
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:
NODE_OPTIONS=--max-old-space-size=4096
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)
Comments
Article is closed for comments.