How do you find memory leaks in android application?

Asked 22-Jan-2018
Viewed 383 times

1

 How do you find memory leaks in android application?


1 Answer


0

To find any memory leaks in android application just follow the simple steps - 

Step 1: First Compile and run the debug build either on your device or emulator such that you are connected to your computer.

Step 2: Go to the suspicious activity, then go back to the previous activity which will pop the suspicious activity from the task stack.
Step 3: In Android Studio -> Android Monitor window -> Memory section, click on Initiate GC button. Then click on Dump Java Heap button.
 How do you find memory leaks in android application?

Step 4: When Dump Java Heap button is pressed, Studio will open the dumped .hprof file. in file viewer, there are several ways you can check the memory leak.use the Analyzer Tasks tool in the top right corner to detect memory leakage in activity. Now Check for the Total Count of the activity object. If there are 1 or more instances then there is a leak.