6892742: Improve root set used by jhat
authorohair
Wed, 18 Nov 2009 11:12:28 -0800
changeset 4320 000f60f6622c
parent 4319 47bb128ae7b3
child 4321 bfe4e99e62e1
6892742: Improve root set used by jhat Reviewed-by: tbell, dcubed Contributed-by: Keith Randall <keith.randall@gmail.com>
jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaStatic.java
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaStatic.java	Wed Nov 18 11:10:18 2009 -0800
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaStatic.java	Wed Nov 18 11:12:28 2009 -0800
@@ -57,7 +57,10 @@
             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();