We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 61d3f57 commit 283232cCopy full SHA for 283232c
gc.md
@@ -101,7 +101,11 @@ init --> forcegchelper
101
forcegchelper --> gcStart
102
```
103
104
-其实就是 mallocgc,shouldhelpgc,runtime.GC 这三个入口。
+其实就是 mallocgc,forcegchelper,runtime.GC 这三个入口。
105
+
106
+* mallocgc,分配堆内存时触发,会检查当前是否满足触发 gc 的条件,如果触发,那么进入 gcStart。
107
+* forcegchelper,在 forcegchelper 中会把 forcegc.g 这个全局对象的运行 g 挂起。sysmon 会调用 test 检查上次触发 gc 的时间到当前时间是否已经经过了 forcegcperiod 长的时间,如果已经超过,那么就会将 forcegc.g 注入到 globrunq。这样会在该 g 被调度到的时候触发 gc。
108
+* runtime.GC 是由用户主动触发的。
109
110
## runtime.GC
111
0 commit comments