6892742: Improve root set used by jhat
Reviewed-by: tbell, dcubed
Contributed-by: Keith Randall <keith.randall@gmail.com>
--- 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();