Skip to content

Commit

Permalink
add tri color marking
Browse files Browse the repository at this point in the history
  • Loading branch information
yoa1226 committed Oct 24, 2024
1 parent 1e368d3 commit 9a7b55d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion _posts/2024-09-20-g1-conc-mark-mark.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class G1ConcurrentMark {

## 三色标记算法

在标记阶段 G1 采用三色标记算法,从 GC root 开始遍历对象,如图开始时只有与 gc root 直接关联的对象是黑色的,随着并发标记的进行,所有与 GC root 直接关联或者间接关联的对象都会变成黑色。
在标记阶段 G1 采用三色标记算法([Tri-color marking](https://en.wikipedia.org/wiki/Tracing_garbage_collection#Tri-color_marking)),从 GC root 开始遍历对象,如图开始时只有与 gc root 直接关联的对象是黑色的,随着并发标记的进行,所有与 GC root 直接关联或者间接关联的对象都会变成黑色。

<image src="/assets/conc-mark/conc-mark-tri-color.png" width="80%"/>

Expand Down

0 comments on commit 9a7b55d

Please sign in to comment.