通过开启参数 --trace-gc
与 --trace-gc-verbose
$ node --trace-gc index.js
[10711:0x3507b20] 36425 ms: Mark-sweep 28.6 (48.2) -> 19.3 (46.7) MB, 3.9 / 0.0 ms ( 10.4 ms in 8 steps since start of marking, biggest step 6.9 ms, walltime since start of marking 77 ms) (average mu = 0.997, current mu = 0.997) finalize incremental marking via task GC in old space requested
[10711:0x3507b20] 36434 ms: Scavenge 21.0 (46.7) -> 5.7 (46.7) MB, 1.0 / 0.0 ms (average mu = 0.997, current mu = 0.997) allocation failure
[10711:0x3507b20] 36494 ms: Scavenge 21.1 (46.7) -> 6.2 (46.7) MB, 2.3 / 0.0 ms (average mu = 0.997, current mu = 0.997) allocation failure
[10711:0x3507b20] 36562 ms: Scavenge 21.1 (46.7) -> 6.0 (46.7) MB, 2.8 / 0.0 ms (average mu = 0.997, current mu = 0.997) allocation failure