Re: JavaMemoryModel: Finalization idioms

From: Hans Boehm (
Date: Sun May 01 2005 - 21:42:34 EDT

I don't think that helps. My understanding is that a WeakReference does
not prevent finalization. An object becomes eligible for finalization as
any WeakReferences to it are cleared.

The fundamental problems here are all the same for finalization and the
various kinds of References. An object may appear unreachable (for
various flavours) before its methods have finished executing and while
some if its subobjects or other data are still being acceessed.


On Sun, 1 May 2005, Bob Lee wrote:

> What if the object created a static weak reference to itself in the
> constructor, and then nulled the weak reference in the finalizer? This
> would remove the need to do something in every method of the object,
> but the performance penalty would probably be higher (i.e. if you
> stored the weak references in a set or something).
> Bob
> On 5/1/05, David Holmes <> wrote:
> > My understanding of this issue is that the client code - that which is
> > referencing the object - must do something to ensure the object remains
> > reachable, but following some protocol involving the finalize method of the
> > object concerned.
> -------------------------------
> JavaMemoryModel mailing list -
JavaMemoryModel mailing list -

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:10 EDT