Solution to finalisation problem [Re: fork()]

Graham Matthews graham at sloth.math.uga.edu
Mon Jun 14 23:14:20 EDT 1999


Graham Matthews:
> If you run *all* finalisers of *all* collected objects before you
> actually delete or partially delete any of those objects then all
> finalisers run in well defined contexts and there are no problems
> with finalisers.
Tim Peters (tim_one at email.msn.com) wrote:
: Sure there are:  finalizers in cycles remain largely useless in practice
: without a way to specify the order in which they're invoked.  Go back to the
: Java part of the thread.  The language can't know whether a cycle needs to
: be finalized in a particular order, or, if it does, what that order may be.
: In Java this has nothing to do with partial deletion:  the spec is very
: clear that the implementation must guarantee that all objects reachable from
: a finalizer are wholly intact when the finalizer is run.  What it doesn't
: say-- because it can't --is that all objects reachable from a finalizer will
: be in a "useful" state.  

I don't understand this phrase "useful" state. If you run a two pass
collector then the order in which you finalise doesn't matter. All
objects will be in a state in which they can be finalised in pass 1 since
nothing is deleted in pass 1. I don't see the problem here at all.

Tim Peters (tim_one at email.msn.com) wrote:
: Understood the first time; but if finalizers are to be invoked on cycle
: members, that's just necessary, not sufficient.
: 
At the risk of sounding completely brain-dead ... huh?!

graham

-- 
           As you grow up and leave the playground
       where you kissed your prince and found your frog
          Remember the jester that showed you tears
                   the script for tears




More information about the Python-list mailing list