On Wed, Jul 24, 2019 at 5:37 AM ding liu <
liudi...@gmail.com> wrote:
>
> We know Go`s GC mark than can check all objects begin from root object. But how to build the object tree? I cann`t find any code in runtime, or any document. Any body has related documents?
The GC never builds a tree. It marks the roots and puts them on a
worklist. Then it loops pulling an item off the worklist, tracing all
pointers, and putting all newly found objects on the worklist. This
loop is done concurrently with program execution. See the long
comment at the top of runtime/mgc.go.
Ian