致命错误:CALL_AND_RETRY_LAST 分配失败 - 进程内存不足 [英] FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
问题描述
节点版本为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 参数处理内存不足并且没有出现分段错误
.
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.
推荐答案
如果你看一下源码:github/v8,看来你试图保留一个非常大的对象.根据我的经验,如果你试图解析一个巨大的JSON 对象,但是当我尝试使用 JSON 和 node0.11.13 解析您的输出时,它运行良好.
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屋!