RFC: Pinning interface for the GC
David Nadlinger
see at klickverbot.at
Sat Oct 13 12:51:03 PDT 2012
On Saturday, 13 October 2012 at 19:34:29 UTC, Alex Rønne
Petersen wrote:
> As for your question: Not quite. A pinned object that points to
> any other unpinned objects will implicitly keep those alive.
> This is at least how I would expect it to work, following the
> principle of least surprise.
But then the GC _does_ have to scan those objects to be able to
mark the whole graph as live, no? Wasn't it this what you were
referring to as "kind of terrible" in your first post?
But yes, for a moving GC, a way to pin objects would have to be
added, and lots of code using GC.add*() for interfacing with C
would have to be changed – or we make those functions actually
pin the objects for backwards compatibility and add a new set of
functions which really just add something as a root.
David
More information about the Digitalmars-d
mailing list