当前位置:网站首页>JVM debugging tool -jmap
JVM debugging tool -jmap
2022-06-24 07:15:00 【Angryshark_ one hundred and twenty-eight】
jmap
jmap Command is a tool that can output all objects in memory , You can even put VM Medium heap, Binary output into text .
Print out something java process ( Use pid) In memory , all ‘ object ’ The situation of ( Such as : Produce those objects , And quantity ).
Command usage :jmap [option]
(to connect to running process) Connect to a running process
jmap [option] <executable <core>
(to connect to a core file) Connect to the core file
jmap [option] [[email protected]]<remote server IP or hostname>
(to connect to remote debug server) Connect to remote debugging service
pid: Target process PID, Process number , May adopt ps -ef | grep java see java Process PID;
executable: produce core dump Of java Executable program ;
core: The message will be printed core dump file ;
remote-hostname-or-IP: long-range debug The hostname or ip;
server-id: only id, Suppose you have multiple remotes on a single host debug service ;
Common commands
Print Java Heap profile , Including the GC Algorithm 、 Heap configuration parameters and heap memory usage in each generation
> jmap -heap 23766
Attaching to process ID 31846, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.71-b01
using thread-local object allocation.
Parallel GC with 4 thread(s)//GC The way
Heap Configuration: // Heap memory initialization configuration
MinHeapFreeRatio = 0 // Corresponding jvm Launch parameters -XX:MinHeapFreeRatio Set up JVM Heap minimum idle ratio (default 40)
MaxHeapFreeRatio = 100 // Corresponding jvm Launch parameters -XX:MaxHeapFreeRatio Set up JVM The maximum idle ratio of the heap (default 70)
MaxHeapSize = 2082471936 (1986.0MB) // Corresponding jvm Launch parameters -XX:MaxHeapSize= Set up JVM The maximum size of the heap
NewSize = 1310720 (1.25MB)// Corresponding jvm Launch parameters -XX:NewSize= Set up JVM Heaped ‘ The new generation ’ Default size of
MaxNewSize = 17592186044415 MB// Corresponding jvm Launch parameters -XX:MaxNewSize= Set up JVM Heaped ‘ The new generation ’ Maximum size of
OldSize = 5439488 (5.1875MB)// Corresponding jvm Launch parameters -XX:OldSize=<value>: Set up JVM Heaped ‘ Old generation ’ Size
NewRatio = 2 // Corresponding jvm Launch parameters -XX:NewRatio=:‘ The new generation ’ and ‘ Old generation ’ The size ratio of
SurvivorRatio = 8 // Corresponding jvm Launch parameters -XX:SurvivorRatio= Set up a young generation Eden District and Survivor Area size ratio
PermSize = 21757952 (20.75MB) // Corresponding jvm Launch parameters -XX:PermSize=<value>: Set up JVM Heaped ‘ Eternal generation ’ Initial size of
MaxPermSize = 85983232 (82.0MB)// Corresponding jvm Launch parameters -XX:MaxPermSize=<value>: Set up JVM Heaped ‘ Eternal generation ’ Maximum size of
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:// Heap memory usage
PS Young Generation
Eden Space://Eden Area memory distribution
capacity = 33030144 (31.5MB)//Eden Total area capacity
used = 1524040 (1.4534378051757812MB) //Eden Zone used
free = 31506104 (30.04656219482422MB) //Eden Area remaining capacity
4.614088270399305% used //Eden Area usage ratio
From Space: // One of them Survivor Area memory distribution
capacity = 5242880 (5.0MB)
used = 0 (0.0MB)
free = 5242880 (5.0MB)
0.0% used
To Space: // the other one Survivor Area memory distribution
capacity = 5242880 (5.0MB)
used = 0 (0.0MB)
free = 5242880 (5.0MB)
0.0% used
PS Old Generation // Current Old Area memory distribution
capacity = 86507520 (82.5MB)
used = 0 (0.0MB)
free = 86507520 (82.5MB)
0.0% used
PS Perm Generation// Current “ Eternal generation ” Distribution of memory
capacity = 22020096 (21.0MB)
used = 2496528 (2.3808746337890625MB)
free = 19523568 (18.619125366210938MB)
11.337498256138392% used
670 interned Strings occupying 43720 bytes.
Print Java Histogram of objects in heap , Each... Can be obtained from this diagram class The number of objects , Occupied memory size and class full name information , close :live, Only the living objects are counted
> jmap -histo 23766
23766: Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding
> jmap -F -histo 23766
Attaching to process ID 23766, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.191-b12
Iterating over heap. This may take a while...
num #instances #bytes class name
----------------------------------------------
1: 245237 26378800 [C
2: 18355 19262448 [B
3: 45062 14682856 [I
4: 245389 5889336 java.util.HashMap$Node
5: 274529 4392464 java.lang.String
6: 44989 4087960 [Ljava.util.HashMap$Node;
7: 68684 3150440 [Ljava.lang.Object;
8: 18342 1841288 java.lang.Class
9: 28573 1828672 java.lang.reflect.Field
10: 42818 1712720 java.util.HashMap
11: 30488 1556088 [Ljava.lang.String;
12: 32420 1037440 java.util.LinkedHashMap$Entry

Print object information waiting to be recycled
> jmap -finalizerinfo 23766
Attaching to process ID 23766, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.191-b12
Number of objects pending for finalization: 0
# Show the current F-QUEUE There is no waiting in the queue Fializer Threads execute finalizer Object of method .
With hprof Binary format will Java The heap information is output to a file , This document can be used MAT、VisualVM or jhat Wait for tools to check
# output to a file , Note that the application will be suspended
> jmap -dump:live,format=b,file=heapDump 23766
Dumping heap to /home/oidd/heapDump ...
Heap dump file created
# Access... Through a browser
> jhat -port 5000 heapDump
Reading from heapDump...
Dump file created Thu Sep 17 08:43:21 CST 2020
Snapshot read, resolving...
Resolving 314429 objects...
Chasing references, expect 62 dots..............................................................
Eliminating duplicate references..............................................................
Snapshot resolved.
Started HTTP server on port 5000
Server is ready.
visit :http://localhost:5000/

边栏推荐
- JVM debugging tool -jvisualvm
- JSON formatting method advantages of JSON over XML
- 毕业季进击的技术
- Are internal consultants and external consultants in SAP implementation projects difficult or successful? [English version]
- 【帧率倍频】基于FPGA的视频帧率倍频系统verilog开发实现
- 在产业互联网时代不再有真正意义上的中心,这些中心仅仅只是化有形为无形而已
- 取模软件 模拟显示验证取模数据正确性 逆向 把点阵数组bin文件转显示
- 【图像分割】基于形态学实现视网膜血管分割附matlab代码
- 0 foundation a literature club low code development member management applet (4)
- 在终端pip install xxx但在pycharm却no module named xxx
猜你喜欢
随机推荐
How do I turn off win10 automatic update? What are the good ways?
JVM调试工具-jmap
JVM调试工具-jstack
[security] how to [host security - hybrid cloud version] support secure access to non Tencent virtual machines
毕业季进击的技术
Coding helps promote the internationalization of Tencent games
Record the problem location experience when an application is suddenly killed
C: use of mutex
SAP实施项目上的内部顾问与外部顾问,相互为难还是相互成就?【英文版】
【问题解决】The connection to the server localhost:8080 was refused
The P2V and V2V software starwind converter is really easy to use
【愚公系列】2022年6月 ASP.NET Core下CellReport报表工具基本介绍和使用
What is JSP technology? Advantages of JSP technology
Vmware tools still exist after normal uninstallation for many times. How to solve it
App management platform app host
开源与创新
In the middle of the year, I have prepared a small number of automated interview questions. Welcome to the self-test
多传感器融合track fusion
Multi sensor fusion track fusion
Typora收费?搭建VS Code MarkDown写作环境








