[gclist] A Java question.
Stefan Monnier
monnier+lists/gc@tequila.cs.yale.edu
Tue, 25 Mar 1997 13:25:38 -0500
> The Java specs allow implementations to ignore finalizers.
> I've been told that all commercial Java implementations
> take that option. Can anyone provide details, confirmation etc?
None of that, but I have hot air:
it seems to make total sense to me: without specifying clearly
under what circumstances and at what time an object will get deallocated,
the implementor can always claim that "as far as the application knows,
the object still hasn't been garbage collected". We're back to the same
point as before: a finalizer should *only* be an optimisation with no
"visible effect" except things like "reduce memory/file-descriptor/etc use"
or somesuch which are generally not considered as "visible effect"
even if they may be of paramount importance to determine whether a program
can run on machine X or not.
Now, if an implementation provides weak-variables but not finalizers, than
it can be argued that it is broken, because it is possible for the application
to see that an object has been deallocated while the finalizer hasn't run yet.
Stefan