Uploaded image for project: 'Java Mission Control'
  1. Java Mission Control
  2. JMC-7514

Rule for FinalizationStatistics

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 9.0.0
    • None
    • Mission Control Core
    • None

        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.

              hirt Marcus Hirt
              egahlin Erik Gahlin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: