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

Erik Gahlin egahlin at openjdk.java.net
Wed May 19 06:23:39 UTC 2021


On Tue, 18 May 2021 22:41:06 GMT, Brent Christian <bchristi at openjdk.org> wrote:

>> Please review this enhancement to add a new JFR event, generated whenever a finalizer is run.
>> (The makeup is similar to the Deserialization event, [JDK-8261160](https://bugs.openjdk.java.net/browse/JDK-8261160).)
>> 
>> The event's only datum (beyond those common to all jfr events) is the class of the object that was finalized.
>> 
>> The Category for the event:
>> `"Java Virtual Machine" / "GC" / "Finalization"`
>> is what made sense to me, even though the event is generated from library code.
>> 
>> Along with the new regtest, I added a run mode to the basic finalizer test to enable jfr.
>> Automated testing looks good so far.
>> 
>> Thanks,
>> -Brent
>
> Brent Christian has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Test flag should be volatile

This looks useful, but I am worried about the performance impact:

- The added allocation for every object that is finalized. 
- The event being enabled in the default configuration. 

The default configuration must be safe to use even in pathological cases, i.e. an application with lots of objects being finalized. It's probably too much overhead (or number of events) for the profile configuration as well.

There is also the added startup cost of JFR. One event may not matter that much, but they all add up. We need to put in place a mechanism that doesn't rely on bytecode instrumentation at runtime. There is an enhancement for that, but it requires some engineering first.

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

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


More information about the core-libs-dev mailing list