您可能遇到的唯一实际限制是节点可用的内存量。使用以下代码进行测试。我使用oneMillion和int32Max成功运行了以下示例。使用int64Max时,我从节点收到以下错误。我正在使用具有4GB
RAM的64位Windows。
FATAL ERROR: CALL_AND_RETRY_2 Allocation failed - process out of memory
要测试的节点代码:
var util = require('util');var int64Max = 9007199254740992; var int32Max = 2147483647;var oneMillion = 1000000;var tenThousand = 10000;var counter = 0;//Exchange the limiter with one of the above vars to test.for (var i = 0; i < oneMillion; i++){ setTimeout(log, 1); //Required as the timeout/callback method will not be called until the loop ends due //to node/js being single threaded. util.log('loop:' + i);}function log(){ util.log('callback: ' + counter++);}


