当前位置 : 主页 > 网页制作 > Nodejs >

node.js –trace-gc输出的含义是什么?

来源:互联网 收集:自由互联 发布时间:2021-06-16
当使用–trace-gc选项时,我得到node.js的输出 [24851] 852 ms: Scavenge 26.8 (57.2) - 20.8 (58.2) MB, 3.1 ms [allocation failure].[24851] 927 ms: Scavenge 28.7 (58.2) - 22.4 (59.2) MB, 2.0 ms [allocation failure].[24851] 1013 ms: S
当使用–trace-gc选项时,我得到node.js的输出

[24851]      852 ms: Scavenge 26.8 (57.2) -> 20.8 (58.2) MB, 3.1 ms [allocation failure].
[24851]      927 ms: Scavenge 28.7 (58.2) -> 22.4 (59.2) MB, 2.0 ms [allocation failure].
[24851]     1013 ms: Scavenge 30.4 (61.2) -> 24.1 (61.2) MB, 2.3 ms [allocation failure].
[24851]     1067 ms: Scavenge 31.6 (62.2) -> 24.8 (62.2) MB, 2.1 ms [allocation failure].
[24851] Speed up marking because marker was not keeping up
[24851] Postponing speeding up marking until marking starts
[24851] Speed up marking because marker was not keeping up
[24851] Postponing speeding up marking until marking starts
[24851] Speed up marking because marker was not keeping up
[24851] Postponing speeding up marking until marking starts
[24851]     1359 ms: Mark-sweep 90.9 (115.1) -> 53.6 (113.7) MB, 9.0 ms (+ 19.3 ms in 105 steps since start of marking, biggest step 1.7 ms) [GC interrupt] [GC in old space requested].
[24851]     1578 ms: Scavenge 69.6 (113.7) -> 62.4 (115.7) MB, 6.0 ms [allocation failure].
[24851]     1676 ms: Scavenge 73.1 (117.7) -> 64.1 (121.7) MB, 5.9 ms [allocation failure].

有人可以解释上面输出中每个项目的含义吗?

我还没有看到任何关于此的文档,但是查看 process.memoryusage()的结果以及使用–trace_gc选项建议:

Scavenge <heapUsed before> (<heapTotal before>) -> <heapUsed after> (<heapTotal after>) MB, <how long the GC pause was>

其中heapUsed和heapTotal是由process.memoryusage()记录的,但更好地解释了by this answer.

网友评论