jmap commonly used commands
1, heap
command: jmap -heap pid
Description: Displays the Java heap Details
2, histo [: live]
command: jmap -histo: live pid
Description: Displays statistics object on the heap
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.
MAT analysis using the dump file
Open dump Figure:
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.
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
Leak Suspects interface suggesting that there may leak memory.
For example large object:
You can view the details of specific issues through the Details!