Android Memory leak series-Analysis Hprof file

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.