Rahul Baradia
Rahul Baradia

Reputation: 11951

Android : How to test memory leak in an application?

I have developed an app, I want to check the Memory leak happening in the app. I am trying with eclipse MAT, but unsuccessful,I am getting HROF file but eclipse MAT unable to read it. Can anybody help me out. Any other way to findout.

Upvotes: 5

Views: 3460

Answers (3)

gm2008
gm2008

Reputation: 4325

@sujith The video is very good. To summarize,

  1. the video talked about a very difficult-to-find leaking by "non-static inner class". There is a detailed explanation about this in this page.
  2. He talked about some important concepts when using Memory Analyzer Tool such as shallow heap vs. retained heap, GC Root and dominator tree.
  3. He showed an example of using MAT to identify a leak. In MAT the most useful tool said by him are Histogram and Dominator Tree. When examining an object further, he used right-click menu "Path to GC Root" and then "Exclude Weak References".

Upvotes: 1

sujith
sujith

Reputation: 2421

I found this video very useful. This talks about things like how to find memory leaks from logcat(garbage collector logs) and how to use memory analyzer(MAT).

Upvotes: 3

Morrison Chang
Morrison Chang

Reputation: 12121

The dump.hprof file from Android needs to be converted. Then you can open the converted-dump.hprof in MAT.

hprof-conv dump.hprof converted-dump.hprof

Upvotes: 4

Related Questions