[gclist] More advice required
Hans Boehm
boehm@hoh.engr.sgi.com
Thu, 10 Jun 1999 11:22:13 -0700
Discussions of finalization order occur fairly regularly in this group, and
it's probably safe to say that there has never been a real consensus.
Experience with a number of systems suggests that it probably doesn't matter
that much what you do; the troublesome cases are really pretty rare.
My view is given in http://reality.sgi.com/boehm/finalization.html
The other approaches I know about are:
- Cedar, Modula 3: Finalize in topological order. Don't finalize cycles.
- PARCPlace Smalltalk: A scheme that's normally described very differently, but
I believe it's actually equivalent to the above.
- Java: Finalization is unordered (for a particular kind of finalization
action), but objects are not collected until they also become inaccessible from
finalizers.
- Scheme: I think various systems implement different schemes, some based on a
more static ordering of finalization.
- our collector: Finalize in topological order. Don't finalize cycles.
Provide hooks for breaking cycles and for other ordering schemes. (The latter
are probably not really necessary. The Modula-3/Cedar scheme already provides
ways to do that by splitting objects into the main object and an executor which
is accessible during finalization. The Smalltalk approach standardizes this
split.)
--
Hans-J. Boehm
boehm@sgi.com