Finalizer being run while class still in use (escape analysis bug)

Luke Hutchison luke.hutch at gmail.com
Wed Oct 10 10:37:28 UTC 2018


>
> We considered doing that; the discussion is online somewhere. I was in
> favour of doing what you suggest, but there is some performance impact
> of preserving liveness for all methods. In the end it was decided that
> we'd provide reachabilityFence.


Separate question: other than using "synchronized (this)" around every
method (including the finalizer), is there a way to emulate
reachabilityFence in JDK 7 and 8? For example, is there some sort of
standard construct I can put in a finally block that references a field of
the object with some sort of a no-op (or low-cost op) that is guaranteed
not to be optimized away?


More information about the hotspot-dev mailing list