Re: [Gc] Two-phase finalization?

Paul Bone <[email protected]> Mon, 9 Nov 2015 09:51:14 +1100
Newsgroups gmane.comp.programming.garbage-collection.boehmgc
Message-ID <20151108225114.GA2943@oxygen>
On Sun, Nov 08, 2015 at 12:28:14PM +0100, David Kastrup wrote:
> 
> Now the problem we encounter is that if some structure A points to B and
> some structure B points to A and both A and B are placed into
> finalization, then the finalization of A will delete the associated C++
> structure.  If now a mark pass is allowed through B, it will try to
> access the deleted C++ structure of A.

The typical "solution" to breaking cycles for finalisation is to arrange
objects differently.  I use "quotes" because this is more of a work-around,
but I believe that it's the best solution anyone has proposed to the general
problem (I don't know if this will be suitable for lillypond).

    You have:

        A* -> B*
        ^     |
        +-----+

    (I use * to indicate that this object has a finalize.


        A1*
        ^
        |
        A -> B*
        ^    |
        +----+

Now B can be finalised first, followed by A1.  So typically you would put
the fields (like file descriptors) in A1 and the other fields in A.  I'm
trying to imagine what this means for Lillypond, maybe they're glyphs for
drawing notes or something...

To make this "safer" you could do the same for B, or all your objects that
require finalisation.

I realize this may not be helpful, it's not exactly the answer you asked
for, and I can't begin to guess at how this would work for Lillypond.
However I would like to say that I LOVE the lillypond software.  I have a
significant vision impairment and lillypond allows me to enlarge my sheet
music (usually by typing it out again).  Thank you!


-- 
Paul Bone