Re: JavaMemoryModel: Finalizers must be run in a finalizer thread

From: Jeremy Manson (
Date: Sun Mar 26 2000 - 14:19:20 EST

Joshua Bloch said:

> I discovered this too, and thought that the spec was completely hosed. On
> further investigation, I found that elsewhere in the spec, it says that the
> thread that runs finalizers "holds no user-visible locks" or some such. I do
> not remember where it says that, but I'm sure that someone else on the list
> remembers.

I do (for the curious). It is in 20.1.11 (chapter 20 describes the Object

> 20.1.11 protected void finalize() throws Throwable


> Java does not guarantee which thread will invoke the finalize method for
> any given object. It is guaranteed, however, that the thread that
> invokes finalize will not be holding any user-visible synchronization
> locks when finalize is invoked.

Here is a pointer to it on the web:

It seems to me that this is probably there not for the sake of the memory
model, but to prevent deadlock. It is still in a counter-intuitive place,
though (it should probably be in 12.6).

JavaMemoryModel mailing list -

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