Online Troubleshooting----High Memory Usage

1. Find the PID of the memory that occupies a large amount of memory (use the top command)
For example, find out the PID is 8763
 
2. View the number of active objects created by the current Java process and the size of the memory occupied
jmap -histo:live $pid > jmap.log
 
For example, to view the surviving objects of the 24102 process:
jmap -histo:live 24102 | more
E.g:
$ /usr/java/default/bin/jmap -histo:live 8763 > ~/jmap.log
 
3. Export the memory usage of the current Java process, which is convenient to analyze with special memory analysis tools (for example: MAT).
jmap -dump:live,format=b,file=jmap.log [pid]
--dump heap to file, live indicates a live object, file specifies the file name

Because full gc will be performed before dump:live, the heap size without live is larger than the heap size with live

-heap print heap summary
-histo[:live] Print heap object statistics, including number of objects, memory size, etc.
E.g: 
$ /usr/java/default/bin/jmap -dump:live,format=b,file=jmap.log  8763
Hint: Dumping heap to /home/dmadmin/jmap.log ...
Heap dump file created
 
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326413209&siteId=291194637