On Wednesday, 22 March 2017 19:04:36 UTC+11, T L wrote:
>
> In this article: https://blog.golang.org/go15gc , it mentions
>
> ..., The GC visits all *roots*, which are objects directly accessible by 
>> the application such as globals and things on the stack, and colors these 
>> grey. ...
>
>
> It lists two kinds of root objects: globals and objects on stacks.
> My question is how objects on heap will be visited?
>

By walking the heap (there are some optimisations to avoid areas of memory 
where no objects are known to be stored)
 

> For every object on heap, is it always been referenced by another global 
> object or another object on a stack?
>

Yes, otherwise it's garbage :) 

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to