设置 V8 旧内存部分的最大内存大小。 随着内存消耗接近极限,V8 会花更多的时间在垃圾回收上,以释放未使用的内存。

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 GiB of memory, consider setting this to 1536 (1.5 GiB) to leave some memory for other uses and avoid swapping.

$ node --max-old-space-size=1536 index.js