FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory when processing large files with fs FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory when processing large files with fs javascript javascript

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory when processing large files with fs


I have finally found the solution to the problem ! I needed to launch the process adding the --max-old-space-size=8192 param to node process like so:

node --max-old-space-size=8192 ./myScript.js

I processed my 1.3GB without a problem !!


You can increase the amount of memory allocated to the command by running the following command prior to running Snyk:

Linux/macOS

export NODE_OPTIONS=--max-old-space-size=8192For example:

export NODE_OPTIONS=--max-old-space-size=8192snyk testexport NODE_OPTIONS=--max-old-space-size=8192snyk monitor

Windows

From the control panel go to System -> Advanced system settings -> Environment Variables -> New (user or system)

enter image description here