Windows 使用jmap: Error attaching to process: Windbg Error: GetModuleParameters failed!

1.使用开发工具Eclipse启动web工程,使用jmap PID 报错。

C:\Users\Lenovo>jps
15760 RemoteMavenServer36
19312
16228 jar
17876 KotlinCompileDaemon
17908 Launcher
10360 jar
10044 Main
13052 KotlinCompileDaemon
18860 Jps

C:\Users\Lenovo>jmap 10360
Attaching to process ID 10360, please wait...
Error attaching to process: Windbg Error: GetModuleParameters failed!
sun.jvm.hotspot.debugger.DebuggerException: Windbg Error: GetModuleParameters failed!
        at sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal.attach0(Native Method)
        at sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal.attach(WindbgDebuggerLocal.java:152)
        at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:671)
        at sun.jvm.hotspot.HotSpotAgent.setupDebuggerWin32(HotSpotAgent.java:569)
        at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:335)
        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.PMap.main(PMap.java:72)
        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)

解决方法:
1.将运行在Eclipse,Idea。打包成.jar文件
2.使用java -jar xxxx.jar 运行程序
3.jps 查询java进程获取 PID
4.jmap PID

C:\Users\Lenovo>jmap -heap 10360
Attaching to process ID 16228, please wait...
Debugger attached successfully.
Client compiler detected.
JVM version is 25.131-b11

using thread-local object allocation.
Mark Sweep Compact GC

Heap Configuration:
   MinHeapFreeRatio         = 40
   MaxHeapFreeRatio         = 70
   MaxHeapSize              = 268435456 (256.0MB)
   NewSize                  = 5570560 (5.3125MB)
   MaxNewSize               = 89456640 (85.3125MB)
   OldSize                  = 11206656 (10.6875MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 12582912 (12.0MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 4294901760 (4095.9375MB)
   G1HeapRegionSize         = 0 (0.0MB)

Heap Usage:
New Generation (Eden + 1 Survivor Space):
   capacity = 5373952 (5.125MB)
   used     = 4152464 (3.9600982666015625MB)
   free     = 1221488 (1.1649017333984375MB)
   77.2702100800305% used
Eden Space:
   capacity = 4784128 (4.5625MB)
   used     = 3689400 (3.5184860229492188MB)
   free     = 1094728 (1.0440139770507812MB)
   77.11750187285959% used
From Space:
   capacity = 589824 (0.5625MB)
   used     = 463064 (0.44161224365234375MB)
   free     = 126760 (0.12088775634765625MB)
   78.50884331597223% used
To Space:
   capacity = 589824 (0.5625MB)
   used     = 0 (0.0MB)
   free     = 589824 (0.5625MB)
   0.0% used
tenured generation:
   capacity = 11833344 (11.28515625MB)
   used     = 10479408 (9.993942260742188MB)
   free     = 1353936 (1.2912139892578125MB)
   88.55829763759087% used

12037 interned Strings occupying 947544 bytes.

原因:
服务启动的jdk和jmap -heap时使用的jdk对应不上(一个是32位,一个是64位

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值