RFR: 8266936: Add a finalization JFR event

Mandy Chung mchung at openjdk.java.net
Mon Jul 12 18:30:00 UTC 2021


On Thu, 8 Jul 2021 19:47:26 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:

> Greetings,
> 
> Object.finalize() was deprecated in JDK9. There is an ongoing effort to replace and mitigate Object.finalize() uses in the JDK libraries; please see https://bugs.openjdk.java.net/browse/JDK-8253568 for more information. 
> 
> We also like to assist users in replacing and mitigating uses in non-JDK code.
> 
> Hence, this changeset adds a periodic JFR event to help identify which classes are overriding Object.finalize().
> 
> Thanks
> Markus

This approach inspecting the loaded classes periodically as well as tracking the classes being unloaded looks good.   A class with the same class name may be loaded from different class loader and could also be loaded from different code source.  It'd be useful for the finalizer event to include the code source which is passed from defineClass to help identify where the class was loaded from.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4731


More information about the core-libs-dev mailing list