【问题标题】:node not allowing custom heap limit (--max-old-space-size)节点不允许自定义堆限制(--max-old-space-size)
【发布时间】:2016-06-15 15:26:00
【问题描述】:

我在 Ubuntu 15.10 上运行 node v6.2.1。

我的机器有 15GB 内存:

>> 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)

关于如何启动具有更高堆限制的节点进程的任何建议?

【问题讨论】:

    标签: node.js heap-memory ubuntu-15.10


    【解决方案1】:

    据我所知,6.2.1 上的(旧空间)内存存在问题。更新到 6.4 看看会发生什么。我在使用 gulp watchers 时遇到了类似的问题。乍一看,4GB 还不够,所以我尝试将其推高至 11.5(这似乎是最大限制)。毕竟,问题出在 gulp.run() 上,因为它现在已被弃用。

    我想说的是,它并不总是与错误所在的内存有关 :)

    这并不能完全回答您的问题,但也许会有所帮助。

    【讨论】:

      猜你喜欢
      • 2018-11-10
      • 2019-11-20
      • 1970-01-01
      • 1970-01-01
      • 2019-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多