[gclist] Finalization and death notices

Kerns, Bob Bob.Kerns@firepond.com
Thu, 11 Oct 2001 11:28:23 -0500


I think the difference here is not quite what it seems. It's not that you
can or can't have two things register the "last pointer". Clearly, there's
no good reason to have to support "N last pointers"; a single reference is
what you want.

Where multiple interested parties come in, is in the *notification* process.
The collector should "own" the last reference; when it should notify the
interested parties. The difference between the two of you is the difference
between "unicast" vs "multicast". (I doubt "broadcast" has a place here!).

Finalizers are inherently "unicast", which I think is a deficiency (though
not insurmountable). If a file is GC'd, I may want to remove the cache
entries that relate to that file; the implementation of File and my cache
are decoupled. I think this is a much cleaner model at both the level of the
collector, at the level of the language, and at the level of the
application.

Finalizers as methods on Object are really a remnant of the early days of
object-oriented programming, when you had large classes with lots of
methods. These days we prefer smaller groups of collaborating objects with a
clear division of responsibilites, with less coupling between the areas of
responsibility.

-----Original Message-----
From: Pekka P. Pirinen [mailto:pekka.p.pirinen@globalgraphics.com]
Sent: Thursday, October 11, 2001 7:29 AM
To: cef@geodesic.com
Cc: gclist@iecc.com
Subject: Re: [gclist] Finalization and death notices


> A near death notice informs a registered custodian that they are the
> only one with a remaining interest in an object and they now hold
> the last remaining thread keeping it alive. You can't have two of
> those.

You're trying to redefine the term to mean something different from
what people used it for.  Sure it sounds like a good story, but I'm
not even sure it's something anyone would want.  Whereas MPS
finalization, guardians, ephemerons, etc. work fine even though you
can register multiple custodians.  If we couldn't call these
near-death notices, we'd need yet another term.
-- 
Pekka P. Pirinen
    I have yet to see any problem, however complicated, which,
when you looked at it in the right way, did not become still
more complicated.	- Poul Anderson