0

I am a newbie on this topic so i researched about MAT on internet but the articles were quite old,and there was something about creating a heap dump and manually converting the file into some other format etc etc.....but as soon as i click on heap dump i get this

enter image description here

so i am guessing that i don't need to convert it anymore or do i??

and i would like to ask that my app takes about 40-120 mb ram.the size keeps increasing due to memory leaks how to find out which variable is causing it?can we even find out memory allocations for separate variables ?

Ankit Srivastava
  • 853
  • 1
  • 9
  • 28

1 Answers1

0

You don't need to convert it any more, hprof is more than enough to find memory leaks

In MAT you click on Histogram and dominator_tree menu. Both will show you list of runtime objects and respective size of retained heap. You can easily get start up point for code analysis based on retained heap size and get to the root of memory leak.

Also, if you click on leak suspects you will get list of problem suspects.

Mind Peace
  • 905
  • 8
  • 29
  • well thank you but since I was unable to find it using mat,I changed the entire structure of my code,nullifying the values whenever they are not required and that helped a lot... :D also came to know that if Context is not nullified,the activity doesn't get destroyed which results in memory leaks.... Still having a few memory leaks but the amount has drastically reduced :D – Ankit Srivastava May 09 '14 at 15:08
  • I still need to know how to clear layouts ..will nullifying them help ? – Ankit Srivastava May 09 '14 at 15:10
  • Absolutely, nullifying object after there use is good practice. Specially closing your JDBC Conn objects etc. If you still face any issue its always recommended to use some tolls like MAT to get the root cause. You can even you JConsole to see memory consumption of your application at run time. As its run time you will easily find when memory demand is higher and you can concentrate on particular functionality. – Mind Peace May 09 '14 at 15:20
  • Thank you help needed here http://stackoverflow.com/questions/23568216/broadcast-is-never-received – Ankit Srivastava May 09 '14 at 15:21