RFC: Pinning interface for the GC

David Nadlinger see at klickverbot.at
Sat Oct 13 13:42:48 PDT 2012


On Saturday, 13 October 2012 at 20:12:04 UTC, Alex Rønne 
Petersen wrote:
> 2) It forces scanning of 'pinned' objects to be imprecise.

I'm not so sure about that.

In the comment section you added to Git core.memory, you wrote 
»Roots are always scanned conservatively. Roots include […] 
memory locations added through the GC.addRoot and GC.addRange 
functions.«. But this statement is problematic, since addRange() 
adds a »memory location« consisting of root pointers, whereas 
addRoot() adds a single (rvalue) root pointer.

Thus, depending on which case you consider, »memory location« 
would refer to different levels of indirection.

As far as I can see, adding objects you want to »pin« as roots 
would only force them to be scanned imprecisely if you'd force 
the entire GC memory block referred to by addRoot() resp. all the 
GC blocks referred to by the range added using addRange() to be 
scanned conservatively. But why would this be necessary?

David


More information about the Digitalmars-d mailing list