如下所示:
****************************** /jmap jdk small version diffrent from jvm jdk vesionbegin/// [dev@iz2ze8us9p89pfk02m9vs1z ~]$ jmap -heap 1541 attaching to process id 1541, please wait... error attaching to process: sun.jvm.hotspot.debugger.debuggerexception: cannot open binary file sun.jvm.hotspot.debugger.debuggerexception: sun.jvm.hotspot.debugger.debuggerexception: cannot open binary file at sun.jvm.hotspot.debugger.linux.linuxdebuggerlocal$linuxdebuggerlocalworkerthread.execute(linuxdebuggerlocal.java:163) at sun.jvm.hotspot.debugger.linux.linuxdebuggerlocal.attach(linuxdebuggerlocal.java:278) at sun.jvm.hotspot.hotspotagent.attachdebugger(hotspotagent.java:671) at sun.jvm.hotspot.hotspotagent.setupdebuggerlinux(hotspotagent.java:611) at sun.jvm.hotspot.hotspotagent.setupdebugger(hotspotagent.java:337) at sun.jvm.hotspot.hotspotagent.go(hotspotagent.java:304) at sun.jvm.hotspot.hotspotagent.attach(hotspotagent.java:140) at sun.jvm.hotspot.tools.tool.start(tool.java:185) at sun.jvm.hotspot.tools.tool.execute(tool.java:118) at sun.jvm.hotspot.tools.heapsummary.main(heapsummary.java:49) 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.debugger.debuggerexception: cannot open binary file at sun.jvm.hotspot.debugger.linux.linuxdebuggerlocal.attach0(native method) at sun.jvm.hotspot.debugger.linux.linuxdebuggerlocal.access$100(linuxdebuggerlocal.java:62) at sun.jvm.hotspot.debugger.linux.linuxdebuggerlocal$1attachtask.doit(linuxdebuggerlocal.java:269) at sun.jvm.hotspot.debugger.linux.linuxdebuggerlocal$linuxdebuggerlocalworkerthread.run(linuxdebuggerlocal.java:138) /jmap jdk small version diffrent from jvm jdk vesionend/// /jmap jdk big version diffrent from jvm jdk vesionbegin/// attaching to process id 30413, please wait... 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: java.lang.internalerror: void* type hasn't been seen when parsing int* at sun.jvm.hotspot.hotspottypedatabase.recursivecreatebasicpointertype(hotspottypedatabase.java:721) at sun.jvm.hotspot.hotspottypedatabase.lookuptype(hotspottypedatabase.java:134) at sun.jvm.hotspot.hotspottypedatabase.lookuporcreateclass(hotspottypedatabase.java:631) at sun.jvm.hotspot.hotspottypedatabase.createtype(hotspottypedatabase.java:751) at sun.jvm.hotspot.hotspottypedatabase.readvmtypes(hotspottypedatabase.java:195) at sun.jvm.hotspot.hotspottypedatabase.<init>(hotspottypedatabase.java:89) at sun.jvm.hotspot.hotspotagent.setupvm(hotspotagent.java:395) at sun.jvm.hotspot.hotspotagent.go(hotspotagent.java:305) at sun.jvm.hotspot.hotspotagent.attach(hotspotagent.java:140) at sun.jvm.hotspot.tools.tool.start(tool.java:185) at sun.jvm.hotspot.tools.tool.execute(tool.java:118) at sun.jvm.hotspot.tools.heapsummary.main(heapsummary.java:49) ... 6 more /jmap jdk big version diffrent from jvm jdk vesionend/// ****************************************
【问题】
执行jmap -heap命令是报错,方法返回参数类型不匹配
【分析】
考虑执行jmap的jdk版本同目标jvm的jdk版本不一致:
1> 如果jmap的jdk版本比目标jvm高,执行会提示方法不兼容错误
2> 如果jmap的jdk版本比目标jvm低,执行会提示jdk版本不一致错误
【解决】
采用执行jmap的jdk版本同目标jvm的jdk版本保持一致。
补充知识:jmap -heap返回结果分析
using parallel threads in the new generation. using thread-local object allocation. concurrent mark-sweep gc heap configuration: minheapfreeratio = 40 maxheapfreeratio = 70 maxheapsize = 4294967296 (4096.0mb) newsize = 858980352 (819.1875mb) maxnewsize = 858980352 (819.1875mb) oldsize = 3435986944 (3276.8125mb) newratio = 4 survivorratio = 8 metaspacesize = 21807104 (20.796875mb) compressedclassspacesize = 1073741824 (1024.0mb) maxmetaspacesize = 17592186044415 mb g1heapregionsize = 0 (0.0mb) heap usage:
新生代
new generation (eden + 1 survivor space): capacity = 773128192 (737.3125mb) used = 95478696 (91.05558013916016mb) free = 677649496 (646.2569198608398mb) 12.349659084738175% used eden space: capacity = 687276032 (655.4375mb) used = 95478696 (91.05558013916016mb) free = 591797336 (564.3819198608398mb) 13.892336056322709% used from space: capacity = 85852160 (81.875mb) used = 0 (0.0mb) free = 85852160 (81.875mb) 0.0% used to space: capacity = 85852160 (81.875mb) used = 0 (0.0mb) free = 85852160 (81.875mb) 0.0% used concurrent mark-sweep generation: capacity = 3435986944 (3276.8125mb) used = 119572370833685648 (1.1403309901588979e11mb) free = 17478152948676 mb 3.480000732903997e9% used
根据以上数据,我们来check一些ratio:
newratio = 2 eden space capacity = 1063256064 (1014.0mb) from space capacity = 4718592 (4.5mb) to space capacity = 5242880 (5.0mb)
简单加法,
new size=1014.0+4.5+5.0=1023.5mb
maxheapsize = 3221225472 (3072.0mb)
年轻代占比:
1023.5/3072.0=1/3。
换算newratio的计算,老年代/新生代,结果为2
以上这篇解决jmap抓取heap使用统计信息报错的问题就是www.887551.com分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持www.887551.com。