Use JVM tuning and real memory overflow --jmap Analysis

table of Contents


jmap use and memory leak analysis

View memory usage

Check the number and size of objects in memory

The memory usage dump to a file

Analysis of the dump file by jhat

Analysis of the dump file by MAT tool

MAT Introduction

MAT download and install

MAT using the steps 


jmap use and memory leak analysis

View memory usage

View tomcat memory usage: jmap -heap tomcat process ID

① heap memory configuration information see:

② view the heap memory usage:

Check the number and size of objects in memory

Use jmap -histo process ID | more to view the number and size of the object. In the Linux system, you can use pipes | more to a section of the output information. Windows systems can also be used.

Use jmap -histo: live process ID | more can view the number of active objects and size:

The memory usage dump to a file

dump down the file is a binary format. 

Analysis of the dump file by jhat

The jvm memory dump to a file, the file is a binary file, not convenient to view, then we can see the aid jhat tools:

You can access through a browser to access port 9999 to dump down the file information:

OQL query links provided bottom of the page:

Queries link  http: // xxx: 9999 / oql /

OQL query example (You can see some examples of statements by OQL Help):

The length of the query> = 100 string which:

select s from java.lang.String s where s.value.length >= 100

It can be seen that the string length is greater than 1000 web.xml configuration files such as:

Description profile in the form of a string are loaded into memory.

Analysis of the dump file by MAT tool

MAT Introduction

MAT download and install

Double click:

MAT using the steps 

Steps for usage:

发布了824 篇原创文章 · 获赞 369 · 访问量 79万+

Guess you like

Origin blog.csdn.net/a772304419/article/details/103992788