mat icon indicating copy to clipboard operation
mat copied to clipboard

Finalizer report does not show all objects available for finalization

Open eclipsewebmaster opened this issue 1 year ago • 2 comments
trafficstars

| --- | --- | | Bugzilla Link | 482964 | | Status | NEW | | Importance | P3 enhancement | | Reported | Nov 25, 2015 01:03 EDT | | Modified | Apr 09, 2020 13:37 EDT | | Reporter | James Livingston |

Description

The Finalizer Overview shows objects being finalized and those queued for finalization, but it would be useful to also see objects that are not queued but would be if the JVM checked.

As a first approximation, all finalizable objects whose only incoming reference is from a Finalizer could be listed: in OQL "SELECT objects f.referent FROM java.lang.ref.Finalizer f where (inbounds(f.referent).size() = 1)"

eclipsewebmaster avatar May 08 '24 18:05 eclipsewebmaster

By Andrew Johnson on Jun 07, 2017 08:12

Would the retained set of all objects in the 'Ready for Finalizer Thread' query be interesting?
Those objects aren't reachable from ordinary threads, so might be eligible for finalization, though another finalizer could make them accessible before they go on the queue.

eclipsewebmaster avatar May 08 '24 18:05 eclipsewebmaster

By Andrew Johnson on Apr 09, 2020 13:37

Another approach for dumps from Oracle-based VMs is to use the Java Basics > References > Finalizer Reference Statistics query.

The 'Only Retained through Finalizer' shows all the objects only retained by finalizers, including finalizable objects on the finalizer queue and finalizable objects no longer directly reachable but which are not yet on the finalizer queue, plus all the other objects they retain.

For dumps from J9 based VMs it is a bit more complicated. In the latest snapshot builds the java.lang.Runtime object holds references via <Unfinalized>
to unfinalized objects. Select the objects, do merge shortest paths to GC roots excluding weak references, select merge to GC roots on class.
That will show the objects with finalizer still in use. The compare query can then be used to take a difference of the histogram of the originally selected objects and the results of the merge to GC roots on class.

eclipsewebmaster avatar May 08 '24 18:05 eclipsewebmaster