[concurrency-interest] DirectByteBuffers and reachabilityFence

Justin Sampson jsampson at guidewire.com
Tue Dec 8 22:25:57 EST 2015


Andrew Haley wrote:

> It's not just HotSpot, though: some VMs are even more aggressive,
> and we have seen finalizers executed even before constructors have
> completed. And that is allowed by the specification.

How so? I mean, I understand that an object may become unreachable
before the completion of its constructor due to inlining, but the
finalizer is not allowed to run at that point:

"The completion of an object's constructor happens-before the
execution of its finalize method (in the formal sense of
happens-before)."

https://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.6

Cheers,
Justin



More information about the Concurrency-interest mailing list