当前位置:网站首页>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/

边栏推荐
- [problem solving] virtual machine configuration static IP
- Laravel document reading notes -laravel str slug() function example
- Spark参数调优实践
- How do I turn off win10 automatic update? What are the good ways?
- 树莓派4B开发板入门
- Are internal consultants and external consultants in SAP implementation projects difficult or successful? [English version]
- Spark项目打包优化实践
- OMX initialization process
- GPU frequency of zhanrui chip
- mysql中的 ON UPDATE CURRENT_TIMESTAMP
猜你喜欢

FreeRTOS MPU makes the system more robust!

Open source and innovation

Win11分磁盘怎么分?Win11系统怎么分磁盘?

超宽带脉冲定位方案,UWB精准定位技术,无线室内定位应用

【图像融合】基于NSST结合PCNN实现图像融合附matlab代码

Big factories are not the only way to measure ability. The three years' experience of Shangcai's graduation

Spark项目打包优化实践

Unexpected token u in JSON at position 0

The data synchronization tool dataX has officially supported reading and writing tdengine

Huawei Cloud Database Advanced Learning
随机推荐
In the middle of the year, I have prepared a small number of automated interview questions. Welcome to the self-test
Why use lock [readonly] object? Why not lock (this)?
【小技巧】使用matlab的深度学习工具箱deepNetworkDesigner快速设计
JVM调试工具-Arthas
[Yugong series] June 2022 asp Basic introduction and use of cellreport reporting tool under net core
捏脸师: 炙手可热的元宇宙造型师
Typora收费?搭建VS Code MarkDown写作环境
Implementation and usage analysis of static pod
Graduation season advance technology
How to send SMS in groups? What are the reasons for the poor effect of SMS in groups?
[security] how to [host security - hybrid cloud version] support secure access to non Tencent virtual machines
EasyDSS_ The dash version solves the problem that the RTSP source address cannot play the video stream
. Net7 miniapi (special part):preview5 optimizes JWT verification (Part 1)
What is JSP technology? Advantages of JSP technology
Another double win! Tencent's three security achievements were selected into the 2021 wechat independent innovation achievements recommendation manual
The data synchronization tool dataX has officially supported reading and writing tdengine
In JS, the regular expression verifies the hour and minute, and converts the input string to the corresponding hour and minute
Unexpected token u in JSON at position 0
0 foundation a literature club low code development member management applet (6)
原神方石机关解密