how to increase nodejs default memory?

后端 未结 4 1120
甜味超标
甜味超标 2020-12-03 13:30

On Server startup exporting 2GB(Approximately) data from mongodb to redis,then getting error as FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of mem

4条回答
  •  天命终不由人
    2020-12-03 13:59

    There are two ways to resolve this, First way is to set memory size explicitly for your application, already answered above. And the other way is to set memory size globally for node - This is done by creating an Environment variable, with

    variable name=NODE_OPTIONS
    

    and

    variable value=--max-old-space-size=4096
    

提交回复
热议问题