Using mat to locate memory leak reason _app special test

Source: Internet
Author: User

Premise:

Running the app

Ddms--update Heap

Click GC to observe heap (mainly see the totle size of data object)

Continue to operate the app

Memory leak (totle size of data object grows until system limit is reached, system no longer allocates memory, app crashes)


Pre-Analysis Preparation:

Get the memory leak file

DDMS, click the toolbar dump prof file to save the leaked file

File conversions

Win+r-cmd--hprof-conv xxx-a.hprof Xxx-b.hprof


Mat Analysis:

Histogram--shallow Heap Sort-list objects-withincoming references--gc root, very well positioned

A.histogarm View


B.shallow Heap Sort, choose the biggest one


C.list objects-withincoming References


D. Then select the max shallow heap, GC root, find the path chain


E. Positioning end (starting from the bottom shallow heap is incremental, retained heap change is not so big, the bottom is the layer of the problem)


Mat Download Address:

http://www.eclipse.org/mat/downloads.php

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.