-
Enhancement
-
Resolution: Fixed
-
P3
-
None
-
None
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JMC-8007 | 9.0.0 | Marcus Hirt | P3 | Resolved | Fixed |
JDK 18 comes with a new FinalizationStatistics event that helps users find where in their application finalizers are run. This is importartant as finalization has been deprecated for removal in a future release. For more information about finalization and its flaws, see https://openjdk.java.net/jeps/421
Even if an application doesn't implement any finalize() methods, it may rely on third-party libraries that does. Static analysis of third-party libraries using "jdeprscan --for-removal" can be used to list those classes, but it will not tell if they are being used. For example, an application may be missing a call to a close() method, so the resource is cleaned up by the finalizer, which is suboptimal.
Metadata:
<Event name="FinalizerStatistics" category="Java Application, Statistics" label="Finalizer Statistics" description="Per class statistics about finalizers" thread="false" startTime="false" period="endChunk">
<Field type="Class" name="finalizableClass" label="Class Overriding Finalize" />
<Field type="Symbol" name="codeSource" label="Code Source" description="URL from where the class was loaded" />
<Field type="ulong" name="objects" label="Finalizable Objects on Heap" description="Number of objects on heap that can be finalized" />
<Field type="ulong" name="totalFinalizersRun" label="Finalizers Run" description="Total number of finalizers run since JVM start" />
</Event>
The event is run at the end of each chunk.
The totalFinalizersRun field is probably the most interesting for now.