[gclist] Finalization and death notices

Charles Fiterman cef@geodesic.com
Mon, 08 Oct 2001 13:24:47 -0500


At 10:44 AM 10/8/01 -0700, you wrote:
>I think it's fairly typical to find one use of finalization in 50,000 lines
>of code.  These are not C++ destructors.  They are not intended to be nearly
>as ubiquitous as the finalization discussion on this list.

I think a fully robust construct would be a lot more useful than that.
You're saying something about the size of the original Boehm Collector will
only have one use for finalizers.

The reason finalizers are so rarely used is that they are neither prompt or
sure and there are few uses for anything having those defects. In addition
they are effectively prohibited from using anything context dependent,
thread local storage, locks, exceptions and forks. On top of that they are
prohibited from using anything order dependent.

The combination of death notices and near death notices implemented by a
combination of garbage collection and reference counting would have a lot
of eager users. 

As a rule of thumb if the construct isn't the preferred method of closing
files something is terribly wrong with it at some level. I expect there
would be a wrapped use of notices which would be used for such things as a
preferred method.

Notices have uses beyond collectors, there are lots of servers with similar
encapsulation restrictions.