增加节点内存

时间:2016-04-08 03:55:27

标签: javascript node.js memory protractor v8

我正在运行Protractor(它使用Node,它使用V8)来运行一些浏览器测试。我开始收到以下内存错误:

02:34:40.051 FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
02:34:40.051 
02:34:40.051 <--- Last few GCs --->
02:34:40.051 
02:34:40.052  1003893 ms: Scavenge 1397.2 (1458.3) -> 1397.2 (1458.3) MB, 1.1 / 0 ms (+ 59.3 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
02:34:40.052  1004839 ms: Mark-sweep 1397.2 (1458.3) -> 1397.2 (1458.3) MB, 945.8 / 0 ms (+ 118.0 ms in 11 steps since start of marking, biggest step 59.3 ms) [last resort gc].
02:34:40.052  1005782 ms: Mark-sweep 1397.2 (1458.3) -> 1397.2 (1458.3) MB, 943.3 / 0 ms [last resort gc].
02:34:40.052 
02:34:40.052 
02:34:40.052 <--- JS stacktrace --->
02:34:40.052 
02:34:40.052 ==== JS stack trace =========================================
02:34:40.052 
02:34:40.052 Security context: 0x1e4bb62e3ac1 <JS Object>
02:34:40.052     2: encode64s [/var/lib/tests/node_modules/gherkin/lib/gherkin/formatter/json_formatter.js:~126] [pc=0x2c20b5f516fc] (this=0x1e4bb62fc3c9 <JS Global Object>,input=0x39ae3bb04101 <Very long string[150450]>)
02:34:40.052     3: embedding [/var/lib/tests/node_modules/gherkin/lib/gherkin/formatter/json_formatter.js:...
02:34:40.052 

从我可以收集的内容来看,这可能与节点分配了512mb内存并且基本耗尽的节点有关。

现在,我知道我可以使用&#34; max_old_space_size&#34;来增加分配给Node的RAM数量。然而,论证,量角器&#34;包装&#34; script使用以下命令启动Node:

#!/usr/bin/env node

process.env.NODE_ENV = process.env.NODE_ENV || 'test';

require('../lib/cli.js');

并在&#34; node&#34;之后将此选项添加到顶行。没有工作(运行量角器只是挂起而且不会产生任何输出)。

在这种情况下,如何增加分配给Node(和V8)的RAM量?

0 个答案:

没有答案