RFR (S) 8073532: jmap -heap fails after generation array removal
Bengt Rutisson
bengt.rutisson at oracle.com
Fri Feb 20 12:09:18 UTC 2015
Hi Mikael,
Looks good!
Thanks,
Bengt
On 2015-02-20 12:55, Mikael Gerdin wrote:
> Hi all,
>
> Please review this small fix to an issue introduced by JDK-8061802.
>
> The API in the SA is pretty strange, but a "Field" object basically
> only encodes the type and offset of a non-static field, so to get what
> the field points to you must supply "this.addr", which is the base
> address of the containing object.
>
> An alternate fix could have been to call getAddress(addr), but a quick
> look at the other usages of AddressField seems to suggest that
> getValue(addr) is the preferred way.
>
> Webrev: http://cr.openjdk.java.net/~mgerdin/8073532/webrev.0/
> Bug: https://bugs.openjdk.java.net/browse/JDK-8073532
>
> Testing:
> Ran jdk/test/sun/tools/jmap/heapconfig/JMapHeapConfigTest.java with
> -XX:+UseSerialGC before/after fix.
> Ran "jmap -heap" and inspected the output to verify that the correct
> output is produced with the fix applied:
> == Before fix ==
> Heap Usage:
> Exception in thread "main" java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at sun.tools.jmap.JMap.runTool(JMap.java:201)
> at sun.tools.jmap.JMap.main(JMap.java:130)
> Caused by: sun.jvm.hotspot.types.WrongTypeException
> at
> sun.jvm.hotspot.types.basic.BasicField.getAddress(BasicField.java:246)
> at
> sun.jvm.hotspot.types.basic.BasicFieldWrapper.getAddress(BasicFieldWrapper.java:131)
> at
> sun.jvm.hotspot.memory.GenCollectedHeap.getGen(GenCollectedHeap.java:79)
> at sun.jvm.hotspot.tools.HeapSummary.run(HeapSummary.java:89)
> at sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
> at sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
> at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
> at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:49)
> ... 6 more
>
> == With fix ==
> Heap Usage:
> New Generation (Eden + 1 Survivor Space):
> capacity = 157941760 (150.625MB)
> used = 14044472 (13.393852233886719MB)
> free = 143897288 (137.23114776611328MB)
> 8.892184055692427% used
> Eden Space:
> capacity = 140443648 (133.9375MB)
> used = 14044472 (13.393852233886719MB)
> free = 126399176 (120.54364776611328MB)
> 10.000076329546781% used
> From Space:
> capacity = 17498112 (16.6875MB)
> used = 0 (0.0MB)
> free = 17498112 (16.6875MB)
> 0.0% used
> To Space:
> capacity = 17498112 (16.6875MB)
> used = 0 (0.0MB)
> free = 17498112 (16.6875MB)
> 0.0% used
> tenured generation:
> capacity = 350945280 (334.6875MB)
> used = 0 (0.0MB)
> free = 350945280 (334.6875MB)
> 0.0% used
>
> /Mikael
More information about the hotspot-gc-dev
mailing list