-Jmap troubleshooting tools and MAT

jmap commonly used commands

1, heap
command: jmap -heap pid
Description: Displays the Java heap Details

-Jmap troubleshooting tools and MAT
-Jmap troubleshooting tools and MAT

2, histo [: live]
command: jmap -histo: live pid
Description: Displays statistics object on the heap
-Jmap troubleshooting tools and MAT

3, dump: <dump-options >
command: jmap -dump: format = b, file = heapdump.phrof pid
description: green heap dump dump file snapshot.

Hprof binary format to Java heap dump file to a specified filename. live suboption is optional. If you live sub-option is specified, only the active object in the heap will be dumped.

-Jmap troubleshooting tools and MAT

MAT analysis using the dump file

Open dump Figure:

-Jmap troubleshooting tools and MAT

Important function

1、Histogram

Histogram, lists the number of instances of each class and supports regular expression search, you can also calculate the retained size class for all objects.

-Jmap troubleshooting tools and MAT

Shallow Heap is memory size of the object itself, not its object referenced memory, not actual analysis role.

Retained Heap calculated value is RSet (GC when those objects to be recovered when the object is a collection of recovered) size of the object in all superimposed. Or, because X is released, causing all other objects are released (including recursive release) heap size occupied.

1. Select a Class, right-select List objects> with incoming references, object information displayed by this class created a new page.
2, and then select an object, right click and choose Path to GC Roots> ****, usually in troubleshooting memory leaks, we will choose to exclude all phantom / weak / soft etc.references , meaning viewing exclude phantom reference / weak references / soft references and other references chain, which is a strong reference chain.

2、Leak Suspects

-Jmap troubleshooting tools and MAT
Leak Suspects interface suggesting that there may leak memory.
For example large object:
-Jmap troubleshooting tools and MAT

You can view the details of specific issues through the Details!

Guess you like

Origin blog.51cto.com/janephp/2432551