Reprint please indicate the source http://www.cnblogs.com/weiwangnuanyang/p/5703702.html, thank you.
If you just want to determine if there is a memory leak in a scene, the Androidstadio console has a good tool that repeatedly checks to see if the curve is up, and if the curve goes up, it indicates a memory leak.
However, the tools above are not powerful enough to see the reference relationships of the specific classes and classes that reside in memory.
Here is to focus on the solution to the Android memory leak must bea tool-memory analysis; Specific installation method please visit Niang.
We highlight here how to use memory analysis to generate and analyze hprof files.
1. Generate the Hprof file.
Building the HPROF file is simple, in Eclipse's Ddms view, click on the process you need to debug, then click the [DUMP HPROF file] button.
For the memory leak problem is generally need to compare and analyze, so if there is no automated test environment, manual testing can enter the app to save a hprof file,
And then began to repeatedly test the leak scene 20+ times, save a hprof file, and then repeatedly operation 20+ Times, and then save a hprof file.
2. Analyze the Hprof file.
The following is an overview view after opening a hprof file.
From this overview view we can see
Details: Shows the total size, classes size, objects size, ClassLoader quantity, unreachable objects histogram (can be recycled object histogram);
Android Memory leak series-Analysis Hprof file