严重错误:CALL_AND_RETRY_LAST分配失败-内存不足 [英] FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

查看:473
本文介绍了严重错误:CALL_AND_RETRY_LAST分配失败-内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

节点版本为v0.11.13

根据sudo top崩溃期间的内存使用率不会超过3%

Memory usage during crash according to sudo top not raises over 3%

再现此错误的代码:

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

request.get("http://pubapi.cryptsy.com/api.php?method=marketdatav2",function(err,res)
{
    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 )
})

要检查是否存在递归堆栈大小问题,我使用--stack-size = 60000参数运行了下一个代码

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);
    recurse();
})();

并且已经

264500 
Segmentation fault

然后我运行了致命错误代码:CALL_AND_RETRY_LAST分配失败-使用相同的--stack-size = 60000参数处理内存不足,并且没有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.

所以我得出结论CALL_AND_RETRY_LAST与递归堆栈大小没有共同之处.

So I conclude CALL_AND_RETRY_LAST 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.

关于stackoverflow也有类似的问题,但是这些问题都不是关于CALL_AND_RETRY_LAST的,这就是为什么我创建了单独的问题.

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

推荐答案

如果您查看源代码:

If you have a look at the source: github/v8, it seems that you try to reserve a very big object.According to my experience it 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.

您不需要更多的--stack-size,您需要更多的内存:--max_new_space_size和/或--max_old_space_size.

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

除此以外,我唯一能给您的提示是尝试另一个JSON解析器和/或尝试将输入格式更改为JSON行而不是仅JSON.

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

这篇关于严重错误:CALL_AND_RETRY_LAST分配失败-内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆