[jmm-dev] Non-core-model issues status

Andrew Haley aph at redhat.com
Mon Sep 8 09:11:19 UTC 2014

On 07/09/14 06:55, Hans Boehm wrote:
> I think the
> premature finalization issue we're talking about is the most serious
> problem we have in this area.

I don't think so.  There is a related problem in that finalizers don't
necessarily run.  This is particularly so with generational collectors
when an object is moved into the old generation, and the old
generation isn't scanned until the heap runs very low.  I have seen
cases where the old generation is never scanned, and the system
eventually runs out of native resources.

This is true of the PKCS11 crypto provider.  It is part of OpenJDK,
and I have been unable to fix it despite working on it for some time.

I have been thinking about a workaround: when a class is annotated as
finalizable, modify the garbage collectors so that its instances are
never placed in the old generation.  My reasoning is that if a class
is finalizable, it probably has some native resource that should be
recycled, and it is best to do so as soon as possible.  And this is
"probably" cheaper than the cost of not moving this object to the old

But even though I believe this would solve some current problems, it's
still not what I'd call "correct".



More information about the jmm-dev mailing list