--max-old-space-size=SIZE
设置 V8 旧内存部分的最大内存大小。 随着内存消耗接近极限,V8 会花更多的时间在垃圾回收上,以释放未使用的内存。
在具有 2 GB 内存的机器上,考虑将其设置为 1536 (1.5 GB),以便为其他用途留出一些内存并避免交换。
$ node --max-old-space-size=1536 index.js
Sets the max memory size of V8's old memory section. As memory consumption approaches the limit, V8 will spend more time on garbage collection in an effort to free unused memory.
On a machine with 2 GB of memory, consider setting this to 1536 (1.5 GB) to leave some memory for other uses and avoid swapping.
$ node --max-old-space-size=1536 index.js