节点不允许自定义堆限制( – max-old-space-size)

我在Ubuntu 15.10上运行节点v6.2.1。

我的机器有15GB的RAM:

>> sudo lshw -class memory *-memory description: System memory physical id: 4 size: 15GiB 

但是,当我尝试以增加堆限制的方式启动节点时:

 node --max-old-space-size=2048 

它立即耗尽内存:

 <--- Last few GCs ---> 25 ms: Mark-sweep 1.9 (19.5) -> 1.9 (19.5) MB, 0.7 / 0 ms [allocation failure] [GC in old space requested]. 26 ms: Mark-sweep 1.9 (19.5) -> 1.9 (19.5) MB, 0.8 / 0 ms [allocation failure] [GC in old space requested]. 27 ms: Mark-sweep 1.9 (19.5) -> 1.9 (19.5) MB, 0.9 / 0 ms [allocation failure] [GC in old space requested]. 28 ms: Mark-sweep 1.9 (19.5) -> 1.9 (19.5) MB, 0.7 / 0 ms [last resort gc]. 29 ms: Mark-sweep 1.9 (19.5) -> 1.9 (19.5) MB, 0.8 / 0 ms [last resort gc]. <--- JS stacktrace ---> ==== JS stack trace ========================================= Security context: 0x3d67857d <JS Object> 2: replace [native string.js:134] [pc=0x4bb3f0c7] (this=0xb523c015 <Very long string[2051]>,N=0xb523d05d <JS RegExp>,O=0xb520b269 <String[2]: \">) 3: setupConfig [internal/process.js:112] [pc=0x4bb3d146] (this=0xb523727d <an Object with map 0x2ea0bc25>,_source=0x454086c1 <an Object with map 0x2ea0deb1>) 4: startup(aka startup) [node.js:51] [pc=0x4bb3713e] (this=0x3d6080c9 <undefined>) ... FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory Aborted (core dumped) 

有关如何以更高的堆限制启动节点进程的任何build议?

据我所知,在6.2.1上有一个(旧空间)内存的问题。 更新到6.4,看看会发生什么。 在使用gulp观察者时,我遇到了类似的问题。 初看起来,4GB是不够的,所以我试图推高到11.5(这似乎是最大的限制)。 毕竟,问题出在gulp.run()上,因为现在已经废弃了。

我想说的是,这并不总是关于错误所在的内存:)

这不完全回答你的问题,但也许是有帮助的。

Interesting Posts