On Wed, Jul 24, 2019 at 5:37 AM ding liu <liuding...@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 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXyWD8Rvdn5AXLixfqoKH9km5yz5QykKDyKc2BH%2B-nrkg%40mail.gmail.com.