Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
261 views
in Technique[技术] by (71.8m points)

How to find Memory Leak Class/Activity in Android

I am New to this Android platfrom. In one application, there is a memory leak. But i couldn't able to find in which actiity or class the memory leak is happening.

I am using MAT to get the infirmation that the memory leak is there or not. But not able to find which activity is leaking.

Please tell me how to find the which activity is leaking.

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Even if this question is quiet old. I think a small tutorial with images might be helpful. So first you need to install the MAT plugin. After a restart click on Dump HPROF file:

Device controls

After some time (about 30 seconds) you'll get a dialog where you can click on finish. Than you get this view:

Dump result

There you left click on the biggest part and filter for with outgoing references. Then you get this view here:

Here you can see that I missed to delete items in my ContentManager where several items were stored in my pending HashMap.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...