increasing the memory limit in node.js

By default the memory limit in Node js is 512 mb. This will cause FATAL ERROR- JS Allocation failed – process out of memory when processing large data files. It can be avoided by increasing the memory limit.

node --max-old-space-size=1024 my-node-script.js #increase to 1gb
node --max-old-space-size=2048 my-node-script.js #increase to 2gb
node --max-old-space-size=3072 my-node-script.js #increase to 3gb
node --max-old-space-size=4096 my-node-script.js #increase to 4gb
node --max-old-space-size=5120 my-node-script.js #increase to 5gb
node --max-old-space-size=6144 my-node-script.js #increase to 6gb
node --max-old-space-size=7168 my-node-script.js #increase to 7gb
node --max-old-space-size=8192 my-node-script.js #increase to 8gb

Search within Codexpedia

Custom Search

Search the entire web

Custom Search