Re:Go Execution Modes
by pjmlp on Thursday September 04, 2014 @11:57AM
(#8268975)
This does not work if the GC updates the pointer concurrently.
[ Parent
| on HN ]
The GC will not update a pointer once it is converted to the type uintptr. It becomes invisible to the precise collector, so the uintptr acts as an id value.
Worse, it might be collected then as the collector might think it is no longer in use.
Re:Go Execution Modes
by ianlancetaylor on Thursday September 04, 2014 @02:36PM
(#8269886)
But it's in the map, so it's in use.
This remark is what triggered my comment
> It becomes invisible to the precise collector
So does the conversion to uintptr remove it from the root lists the GC searches?
It's a map[uintptr]unsafe.Pointer. The key is invisible to the collector, but the value is an unsafe.Pointer, which is will be managed for you by the precise collector.