Improve root set used by hat

Kelly O'Hair Kelly.Ohair at Sun.COM
Mon Nov 2 17:24:43 PST 2009


FYI...

I haven't forgotten about this, still trying to fit it into my
schedule. I'll do openjdk6 too.

I'd like to create a testcase, but I may need to give up on that,
takes too much time to get it right, and make it test the right thing.
Any ideas on a testcase would be welcome.

-kto


Joseph D. Darcy wrote:
> Sundar,
> 
> If you think this change should go back to OpenJDK 6 and other releases, 
> please work with Keith to sponsor the change.
> 
> Thanks,
> 
> -Joe
> 
> A. Sundararajan wrote:
>> Hi,
>>
>> This change looks good to me. Thanks for finding this issue and the fix!
>>
>> Thanks,
>> -Sundar
>>
>> Keith Randall wrote:
>>> Here's a simpler patch that never makes Roots for these static fields 
>>> in the first place:
>>>
>>> --- com/sun/tools/hat/internal/model/JavaStatic.java
>>> ***************
>>> *** 57,64 ****
>>>               id = ((JavaObjectRef)value).getId();
>>>           }
>>>           value = value.dereference(snapshot, field);
>>> !         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();
>>> --- 57,63 ----
>>>               id = ((JavaObjectRef)value).getId();
>>>           }
>>>           value = value.dereference(snapshot, field);
>>> !         if (value.isHeapAllocated()) {
>>>               JavaHeapObject ho = (JavaHeapObject) value;
>>>               String s = "Static reference from " + clazz.getName()
>>>                          + "." + field.getName();
>>>
>>>
>>> On Wed, Oct 7, 2009 at 1:49 AM, Alan Bateman <Alan.Bateman at sun.com 
>>> <mailto:Alan.Bateman at sun.com>> wrote:
>>>
>>>     A. Sundararajan wrote:
>>>
>>>         I agree. Static fields of classes loaded by non-bootstrap
>>>         loaders should not be part of root set.
>>>
>>>         PS. I am not sure  if this is a bug with hat or with heap
>>>         dumpers (the hotspot built-in dumper and SA's dumper). I don't
>>>         remember how "roots" is filled. May be, these static fields
>>>         should not be flagged as roots?
>>>
>>>         -Sundar
>>>
>>>     At least for the built-in heap dumper, static fields aren't
>>>     generated as roots (instead it's system classes and temporary
>>>     placeholders in the dictionary that are generated to the dump as
>>>     "sticky classes", to use a HPROF term). So I suspect this is more
>>>     likely to be a jhat issue.
>>>
>>>     -Alan.
>>>
>>>
>>
> 


More information about the serviceability-dev mailing list