當我運行下面的代碼9999999+時間,節點將返回:遞歸 - 節點的內存不足
FATAL ERROR: CALL_AND_RETRY_2 Allocation failed - process out of memory
Aborted (core dumped)
最新最好的解決方案來解決這個問題,不是增加最大ALLOC大小或任何其他命令線參數?
我想提高代碼質量而不是破解解決方案。
以下是應用程序內遞歸的主要批量。
該應用程序是一個負載測試工具。
a.prototype.createClients = function(){
for(var i = 0; i < 999999999; i++){
this.recursiveRequest();
}
}
a.prototype.recursiveRequest = function(){
var self = this;
self.hrtime = process.hrtime();
if(!this.halt){
self.reqMade++;
this.http.get(this.options, function(resp){
resp.on('data', function(){})
.on("connection", function(){
})
.on("end", function(){
self.onSuccess();
});
})
.on("error", function(e){
self.onError();
});
}
}
a.prototype.onSuccess = function(){
var elapsed = process.hrtime(this.hrtime),
ms = elapsed[0] * 1000000 + elapsed[1]/1000
this.times.push(ms);
this.successful++;
this.recursiveRequest();
}
你想用這段代碼實現什麼? – 2014-11-23 23:03:40
這是一個負載測試應用程序。 – 2014-11-23 23:07:33
使用多機械化代替http://testutils.org/multimechanize/ – peter 2014-11-23 23:09:26