Monday, 2 May 2016

Application memory leak Memory Analysis Tool in android studio

MAT is a useful tool to analyse your memory usage. Before analyse the memory usage, first we need to create the .hprof file from my activities on the app. We can build this .hprof file easily using Android Studio. Here are the steps:
1. Run the test on your app. Do something that potentially can cause memory leak.
2. Initiate GC (Garbage Collector)


3. Dump java heap


4. Open heap snapshot in capture tab on the left side. Then, export the snapshot to standard .hprof.


5. That’s it. Now we have the standard .hprof file. Open this file using MAT. Then start analyse. You can find how to analyse your memory usage using MAT here.


No comments:

Post a Comment