解決JMap抓取heap使用統(tǒng)計(jì)信息報(bào)錯(cuò)的問題
如下所示:
****************************** /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/// ****************************************
【問題】
執(zhí)行jmap -heap命令是報(bào)錯(cuò),方法返回參數(shù)類型不匹配
【分析】
考慮執(zhí)行jmap的jdk版本同目標(biāo)jvm的jdk版本不一致:
1> 如果jmap的jdk版本比目標(biāo)jvm高,執(zhí)行會(huì)提示方法不兼容錯(cuò)誤
2> 如果jmap的jdk版本比目標(biāo)jvm低,執(zhí)行會(huì)提示jdk版本不一致錯(cuò)誤
【解決】
采用執(zhí)行jmap的jdk版本同目標(biāo)jvm的jdk版本保持一致。
補(bǔ)充知識(shí):jmap -heap返回結(jié)果分析
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
根據(jù)以上數(shù)據(jù),我們來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的計(jì)算,老年代/新生代,結(jié)果為2
以上這篇解決JMap抓取heap使用統(tǒng)計(jì)信息報(bào)錯(cuò)的問題就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
ajax實(shí)時(shí)監(jiān)測與springboot的實(shí)例分析
本文將介紹如何使用 AJAX 技術(shù)結(jié)合 Spring Boot 構(gòu)建一個(gè)實(shí)時(shí)反饋用戶輸入的應(yīng)用,我們將創(chuàng)建一個(gè)簡單的輸入框,當(dāng)用戶在輸入框中鍵入文本時(shí),應(yīng)用將異步地向后端發(fā)送請(qǐng)求,感興趣的朋友跟隨小編一起看看吧2024-07-07
java實(shí)現(xiàn)隨機(jī)生成驗(yàn)證碼圖片
這篇文章主要為大家詳細(xì)介紹了java實(shí)現(xiàn)隨機(jī)生成驗(yàn)證碼圖片,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-12-12
Java日常練習(xí)題,每天進(jìn)步一點(diǎn)點(diǎn)(16)
下面小編就為大家?guī)硪黄狫ava基礎(chǔ)的幾道練習(xí)題(分享)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧,希望可以幫到你2021-07-07
java實(shí)現(xiàn)音頻轉(zhuǎn)文本的實(shí)現(xiàn)步驟
本文主要介紹了java實(shí)現(xiàn)音頻轉(zhuǎn)文本的實(shí)現(xiàn)步驟,可以通過使用一些現(xiàn)成的庫或者API來實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2024-05-05
spring-boot中使用spring-boot-devtools的實(shí)現(xiàn)代碼
這篇文章主要介紹了spring-boot中使用spring-boot-devtools的實(shí)現(xiàn)代碼,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-11-11
使用Get方式提交數(shù)據(jù)到Tomcat服務(wù)器的方法
這篇文章將介紹向服務(wù)器發(fā)送數(shù)據(jù),并且服務(wù)器將數(shù)據(jù)的處理結(jié)果返回給客戶端,本文給大家介紹使用Get方式向服務(wù)器發(fā)送數(shù)據(jù),感興趣的朋友一起學(xué)習(xí)吧2016-04-04
Spring Boot應(yīng)用程序同時(shí)支持HTTP和HTTPS協(xié)議的實(shí)現(xiàn)方法
如今,企業(yè)級(jí)應(yīng)用程序的常見場景是同時(shí)支持HTTP和HTTPS兩種協(xié)議,這篇文章考慮如何讓Spring Boot應(yīng)用程序同時(shí)支持HTTP和HTTPS兩種協(xié)議,需要的朋友可以參考下2019-10-10
Java中do-while循環(huán)的使用方法及注意事項(xiàng)詳解
這篇文章主要介紹了Java中do-while循環(huán)的使用方法及注意事項(xiàng)的相關(guān)資料,在Java編程中,do-while循環(huán)是一種基本的循環(huán)控制結(jié)構(gòu),它至少執(zhí)行一次循環(huán)體,然后根據(jù)條件判斷是否繼續(xù),文中將用法介紹的非常詳細(xì),需要的朋友可以參考下2024-10-10

