Skip to main content

HOW TO DETECT MEMORY LEAKS IN ANDROID

Published: · Last updated: · 3 min read
Don Peter
Cofounder and CTO, Appxiom

Memory leak is one of the most critical issues that can occur in an app. Fixing them is often challenging as the developer will not have access to the relevant data to identify the root cause. All that developer may get to see is an OutOfMemory (OOM) Exception with a stack trace that is of no practical use.

There are tools like LeakCanary for Android and XCode Leaks Instrument for iOS. These tools will help identify the leaks in the development environment. That is, if the developer proactively profiles the app for all possible use cases.

But what if the developer and the tester missed some use cases and there are leaks happening after the app has gone live? How will they know if leaks exist or not in live apps? Here is where Appxiom becomes the developer's best friend as it can detect such issues in live apps and also during development and testing.Appxiom production mode Android SDK detects memory leaks in Android Activities and Services out of the box and reports the bugs to the dashboard with important data such as activity trail, device info and device state info. This will help developer to be aware of the leaks happening in their app that is running in their users' devices and also helps them to reproduce the memory leak.

Here is a screenshot of such a leak detected by Appxiom in a live app.

Memory leak detection in a live app. The actvity that leaks is identified and reported.Now the developer can use debug mode SDK of Appxiom to drill down the issue further in the development environment. As seen in the below screenshot, debug mode SDK of Appxiom will detect the exact object that is causing the leak.

Memory leak detection during development / testing. The exact object that leaks is identified and reported.As seen in the screenshot, the static object ProgressBarManager is causing the leak. With this object level information, it is much easier now for the developer to fix memory leaks.

Apart from memory leaks, Appxiom detects API call issues, frame rate issues, abnormal memory usage, crashes, exceptions, function failures & delays. It also has the capability to report custom issues.The memory leak detection is available in Appxiom iOS framework as well. Read the blog article Detect memory leaks in iOS to understand know more.

Visit appxiom.com to know more about Appxiom. Detailed documentation is available at docs.appxiom.com.

Related Blog Posts

  • Detect memory leaks in iOS (Objective-C & Swift)

  • How to Detect Memory Leaks in WatchOS apps that are created using Objective-C or Swift