I was having a problem with loading large image files into a node.js application today on Ubuntu. It turns out that the maximum memory limit as standard for the V8 engine is 512mb.
To increase it use the following command from the command line.
node --max-old-space-size=8192 my-node-script.js
This will increase the memory limit up to 8GB, adjust according to your system.