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
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