Use mat to compare multiple heap dump files
When debugging memory leaks, it is useful to compare two or more heap dump files in a timely manner. In this case, multiple separate hprof files must be generated.
The following describes how to compare multiple heap dumps in mat (a little complicated ):
1. The first hprof file (usingfile> open heap dump ).
2. Open histogram view.
Figure 1. histogram View button
3. In the navigationhistory view, right-click histogram and select Add to compare basket.
4. Open the second hprof file and redo steps 2 and 3.
5. Switch to the Compare basket view and click Compare the results (red in the upper right corner of the View "! "Icon ).
Figure 2. Comparison and analysis results
As shown in the preceding figure, the weak represented by objects #1 is displayed. create. hprof is better than the main. hporf has a weakreferencesactivity; objects #2 has more than 10000 wfobject objects, and the result is obvious.
This article is originally written by sodino and published on the blog:Http://blog.csdn.net/sodino, Reprinted, please indicate the source.
The related code can be downloaded from the group file in the QQ Group code2share (363267446.