JDK-6892742 : Improve root set used by jhat
  • Type: Enhancement
  • Status: Closed
  • Resolution: Fixed
  • Component: core-svc
  • Sub-Component: tools
  • Priority: P3
  • Affected Version: 7
  • OS: generic
  • CPU: generic
  • Submit Date: 2009-10-18
  • Updated Date: 2011-04-19
  • Resolved Date: 2011-04-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 7
7 b78Fixed
Description
See http://mail.openjdk.java.net/pipermail/serviceability-dev/2009-October/001591.html


diff --git a/src/share/classes/com/sun/tools/hat/internal/model/JavaStatic.java b/src/share/classes/com/sun/tools/hat/internal/model/JavaStatic.java
--- a/src/share/classes/com/sun/tools/hat/internal/model/JavaStatic.java
+++ b/src/share/classes/com/sun/tools/hat/internal/model/JavaStatic.java
@@ -57,7 +57,10 @@ public class JavaStatic {
             id = ((JavaObjectRef)value).getId();
         }
         value = value.dereference(snapshot, field);
-        if (value.isHeapAllocated()) {
+        if (value.isHeapAllocated() &&
+            clazz.getLoader() == snapshot.getNullThing()) {
+            // static fields are only roots if they are in classes
+            //    loaded by the root classloader.
             JavaHeapObject ho = (JavaHeapObject) value;
             String s = "Static reference from " + clazz.getName()
                        + "." + field.getName();

Comments
EVALUATION http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/9fd2e11a9ae6
2009-12-08

EVALUATION http://hg.openjdk.java.net/jdk7/tl/jdk/rev/ce94cd61b33e
2009-11-18

EVALUATION See description.
2009-10-18