On Wednesday, March 22, 2017 at 4:08:02 PM UTC+8, Dave Cheney wrote:
>
>
>
> 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)
>

Walking the heap is at collecting stage? Will the heap be walked at 
analyzing stage?
 

>  
>
>> 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 :) 
>

So when a memory block for a local object is allocated on heap, there will 
be also a pointer, which stores the address of the memory block, recorded 
on stack?
So that the memory block on heap will be tracked from stack?
 

-- 
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