How can I determine if my android app has memory leak?-ThrowExceptions

Exception or error:

I look all over the internet\goolge\stackoverflow and couldn’t find full and simple guide that can explain to me how can I find if my android app has a memory leak.
Can anyone explain to me how to do it, or even better give me good guide for it?

My app collecting data about the battery and saves it to DB on the phone.
Each time that their is a change in the battery (ACTION_BATTERY_CHANGED) I check if the battery precentage changed and in this case I save some data.

This app takes (25-30)MB RAM I think that this is too much for such simple app.I suspect that it has a memory leak.

How to solve:

You can use MAT

It is a very good tool and gives very detailed report of your project with basic information linked with memory leaks

MAT in Android

How to use MAT

Eclipse integration of MAT

Update Site:

Eclipse integration of BERT (dependency on this )

Memory Analyzer Tool in android?


When I faced the same problem as you, I found LeakCanary. It helps to detect memory leaks during runtime in debug builds and provides comfortable UI for the stacktrace history. Here you can read more information about this tool for detecting memory leaks as well as some other useful hints for Android development:
Hope it works for you and other mobile developers!


Generally if you use an application and it’s accumulating memory

12 MB … 13.5 MB…15 MB … think about a cloud that accumulates humidity … etc

If you see this pattern than your app has memory leak.

Another possibility is that you don’t have a leak but you just use too many objects or too big objects or that you do not economize objects well enough.
take under account that bitmaps are very expensive so handling bitmaps may not be so trivial in android which is memory and resource limited environment.

Leave a Reply

Your email address will not be published. Required fields are marked *