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

Kim Barrett kim.barrett at
Wed Oct 10 15:53:50 UTC 2018

> On Oct 10, 2018, at 10:01 AM, Attila Szegedi <szegedia at> wrote:
> I think the general consensus is that finalization is a shunned feature[1]. Weakening optimizations, or really making any tradeoff no matter how small for the purpose of improving finalization ergonomics is not going to happen as there’s no perceived value in doing it.

Finalization was deprecated in JDK 9 (*).  There's an ongoing (though
progressing slowly) process of eliminating its usage in the JDK.
Sometime after that it may go away entirely, or perhaps require some
sort of explicit opt-in, making it possible to eliminate various GC
overheads associated with it.

(*) Use PhantomReference, or a helper like java.lang.ref.Cleaner.
Though that change the liveness question in this thread.

More information about the jdk-dev mailing list