RFR: 8266936: Add a finalization JFR event [v4]

Brent Christian bchristi at openjdk.java.net
Wed Jul 28 22:12:28 UTC 2021


On Tue, 27 Jul 2021 15:14:29 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
>
> Markus Grönlund has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove build directive

Hi, Bernd

The JFR event can complement static bytecode analysis, reporting which classes with finalizers actually get loaded at runtime. 

I agree that it would be useful to add a count for finalizers that get run, either as part of this PR, or as a follow-up.  I would hesitate to add timing, though.  It's important to keep the overhead of this event low, and finalize() methods should already show up in current profilers.

Thanks,
-Brent

> _Mailing list message from [Bernd Eckenfels](mailto:ecki at zusammenkunft.net) on [core-libs-dev](mailto:core-libs-dev at mail.openjdk.java.net):_
> 
> Hello,
> 
> I know I am a bit late, but just wanted to mention, that since finding finalizers with Bytecode analysis is doable (and probably easier to deal with such scan reports), I don?t see much value in a JFR event, especially considering it even has native code executed. (Not so sure about dynamically loaded classes, would the event content help to identify sources?)
> 
> Having said that, this event would be more useful from a runtime perspective if It would actually record execution counts and time per class. Then one can concentrate on the worst offenders, first and even use it for runtime monitoring. Is there already a finalizer profiler?
> 
> Gruss
> Bernd

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

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


More information about the core-libs-dev mailing list