Objective
have seen this blog before, "IBM use Eclipse Memory Analyzer for heap dump file analysis. So, you want to use mat to analyze the memory of the Android app. And just see this blog "Android Memory leak research", so I also summed up some of the use of mat.
1. Install Mat on Eclipse, same as installing other plugins, the current address of mat: http://download.eclipse.org/mat/1.4/update-site/Installation
Restart eclipse when you're done.
2. On the device page, select the app,1 that corresponds to the package name. Click on the icon and wait for a while and the results of Figure 2 will appear.
Figure 1
Figure 2
Based on the results of the analysis, we can see the memory usage of the app. Click on the histogram of the Action tab in the lower left corner to use the Histogram form
View the number of objects and the amount of memory consumed.
Figure 3
The object shown in Figure 3 can display up to 31, but we can filter it based on the package name and the class name. Most importantly, we can right-click to view
object is referenced by which objects, so that we can analyze the reason why the object is not being GC, and then check the corresponding code.
Figure 4
Figure 5
As you can see, the activity is referenced by the path. As you can see, the activity has already been completed, but Gifview still retains its reference, resulting in the inability to GC.
Again, we can analyze the objects that take up the most memory and then look at their reference tree. Note: Not all objects that take up more memory will
Cause a memory leak. For example, a larger picture, when it needs to be displayed, it is clear that its corresponding byte array should appear in memory.
-------------------------------------------------------------------
more communication, Android Development Alliance QQ Group: 272209595
Android:mat Use of memory analysis tools