user619271 user619271 - 4 months ago 555x
Node.js Question

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

Node version is


Memory usage during crash according to
sudo top
not raises over

Code that reproduces this error:

var request = require('request')
var nodedump = require('nodedump')

var data
console.log( "Data received." );
data = JSON.parse(res.body)
console.log( "Data parsed." );
data = nodedump.dump(data)
console.log( "Data dumped." );
console.log( data )

To check if that a recursion stack size problem I have ran next code with --stack-size=60000 parameter

var depth = 0;

(function recurse() {
// log at every 500 calls
(++depth % 500) || console.log(depth);

and have got

Segmentation fault

Then I ran code which gives me FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory with the same --stack-size=60000 parameter and haven't got
Segmentation fault

So I conclude
has nothing common with the recursion stack size.

How could I solve this problem? I believe there is enough free memory on my computer to finish this task successfully.

There are similar questions on stackoverflow but none of this questions are about
that's why I created separate question.


If you have a look at the source: github/v8, it seams that you try to reserve one very big object? My experience is this happens if you try to parse a huge JSON object, but when I try to parse your output with JSON and node0.11.13, it just works fine.

You don't need more --stack-size, you need more memory: --max_new_space_size and/or --max_old_space_size.

The only hint I can give you beside that: try another JSON-parser and/or try to change the input format to JSON line instead of JSON only.