File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -308,17 +308,19 @@ func gcStart(mode gcMode, trigger gcTrigger) {
308308 systemstack (func () {
309309 finishsweep_m ()
310310 })
311- // clearpools before we start the GC. If we wait they memory will not be
312- // reclaimed until the next GC cycle.
311+
312+ // 清除全局的 :
313+ // 1. sudogcache(sudog 数据结构的链表)
314+ // 2. deferpool(defer struct 的链表的数组)
315+ // 3. sync.Pool
313316 clearpools ()
314317
315318 work.cycles ++
316- if mode == gcBackgroundMode { // Do as much work concurrently as possible
319+ if mode == gcBackgroundMode { // 尽量多地提高并发度
317320 gcController.startCycle ()
318321 work.heapGoal = memstats.next_gc
319322
320- // Enter concurrent mark phase and enable
321- // write barriers.
323+ // 进入并发标记阶段,并让 write barriers 开始生效
322324 //
323325 // Because the world is stopped, all Ps will
324326 // observe that write barriers are enabled by
Original file line number Diff line number Diff line change 1+ # memory barrier
2+
3+ memory barrier 也称为 memory fence。
4+
5+ 参考资料:
6+
7+ https://homes.cs.washington.edu/~bornholt/post/memory-models.html
8+
9+ https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
You can’t perform that action at this time.
0 commit comments