Re: JavaMemoryModel: Memory model and finalize methods

From: Bill Pugh (
Date: Tue Dec 14 1999 - 15:02:27 EST

> Future
>implementations could use instructions (which might or might not exist) which
>only flushed certain cache lines, but such an optimization would be rendered
>impossible by Bill's proposed finalizer semantics.

I realize that my proposed semantics for finalizers will create some
issues for you. But without some memory semantics, it isn't clear if
finalizers can be used at all. I would expect that most objects will
not have finalizers. I think you could implement something that has
only a minor performance hit for objects with finalizers, and no hit
for objects without finalizers. You could implement something like:

If an object has a finalizer, then it cannot be run as soon as the
object becomes unreachable. Instead, it must go into a special queue.
Periodically, if that queue is not empty, the system will force a
global memory barrier (stopping the world if needed), and then make
the finalizers in the queue executable.

JavaMemoryModel mailing list -

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