Node.JS - 将 max-old-space-size 设置得太大有什么副作用吗?
Node.JS - any side effects of setting max-old-space-size too large?
我们的服务器 运行s Node.JS 在云 PaaS(特别是 Bluemix)上。
我们可以通过 PaaS 仪表板配置分配的内存量,但我注意到对于 ~1.4GB 以上的值,您还需要使用 --max-old-space-size
选项执行节点(解释 here)。
这意味着每当我想更改分配内存的大小时,我必须在设置中的两个地方进行更改。
如果我调用 node --max-old-space-size 99999999999 app.js
会怎样? Node.JS 会尝试分配 99999999999MB,还是会考虑 运行 所在的 VM\Container 的实际内存限制?它是否会影响 GC 的行为(即,如果看起来有很多空闲 space,GC 将 运行 次数减少)?有--max-old-space-size use-machine-limits
选项吗?
谢谢
What would happen if I call node --max-old-space-size 99999999999
app.js? Will Node.JS try to allocate 99999999999MB, or will it
consider the actual memory-limit of the VM\Container in which it runs?
Node 不会分配上述内存,但它会尝试,以响应不断增长的内存需求,如果发生这种情况,在应用程序中 - 增量地,以相当小的块。
Does it affect the behavior of the GC (i.e. if it looks like there is
a lot of free space, the GC will run less times)?
是的,任期 space 可以包含很多垃圾,并且取消分配的频率会降低。
Is there a --max-old-space-size use-machine-limits option?
老实说,我不知道 - 但会研究这个,如果我得到这方面的信息,会在这里更新。
希望对您有所帮助。
提供较大的堆大小会使 gc 变慢并保留旧值。但是,提供较大的堆大小会导致频繁的 gc 操作,并且可能会出现“内存不足”异常的威胁
我们的服务器 运行s Node.JS 在云 PaaS(特别是 Bluemix)上。
我们可以通过 PaaS 仪表板配置分配的内存量,但我注意到对于 ~1.4GB 以上的值,您还需要使用 --max-old-space-size
选项执行节点(解释 here)。
这意味着每当我想更改分配内存的大小时,我必须在设置中的两个地方进行更改。
如果我调用 node --max-old-space-size 99999999999 app.js
会怎样? Node.JS 会尝试分配 99999999999MB,还是会考虑 运行 所在的 VM\Container 的实际内存限制?它是否会影响 GC 的行为(即,如果看起来有很多空闲 space,GC 将 运行 次数减少)?有--max-old-space-size use-machine-limits
选项吗?
谢谢
What would happen if I call node --max-old-space-size 99999999999 app.js? Will Node.JS try to allocate 99999999999MB, or will it consider the actual memory-limit of the VM\Container in which it runs?
Node 不会分配上述内存,但它会尝试,以响应不断增长的内存需求,如果发生这种情况,在应用程序中 - 增量地,以相当小的块。
Does it affect the behavior of the GC (i.e. if it looks like there is a lot of free space, the GC will run less times)?
是的,任期 space 可以包含很多垃圾,并且取消分配的频率会降低。
Is there a --max-old-space-size use-machine-limits option?
老实说,我不知道 - 但会研究这个,如果我得到这方面的信息,会在这里更新。
希望对您有所帮助。
提供较大的堆大小会使 gc 变慢并保留旧值。但是,提供较大的堆大小会导致频繁的 gc 操作,并且可能会出现“内存不足”异常的威胁