Increasing Node’s Memory
How to break out of the 1.76GB deafult memory limit for node.js processes.
Yesterday our frontend build started running out of memory. Like a lot of people, we use
Luckily node let’s you up the memory limit with the archaically named
--max-old-space-size=SPACE_IN_MB flag. And to make life even easier, it allows you to globally set these options in the environment, so you don’t need to worry about catching every node invocation yourself:
export NODE_OPTIONS=--max-old-space-size=8192 (for example).
The lesson: If you need more than 1.76GB of memory in node, use the
--max-old-space-size=SPACE_IN_MB argument (or
NODE_OPTIONS environment variable) to get some more!