Huge battery drain / memory leak on android


What is the best way to go about hunting down a memory leak on android? We are getting massive battery drain on a few android devices… to the point where it drains so fast that the phone can’t be charged quick enough and eventually runs out of juice entirely.

Hunting these kinds of things is not something we’ve had to do before now so any points at good guides or debugging ideas are really really welcome :slight_smile:


Well it’s either in your webview (e.g. your code) or natively in plugins. To potentially eliminate the former, you could use chrome dev tools to take a snapshot of whatever activity is contributing to the drainage issue and figure out if that’s your problem, and try to optimize. If your webview isn’t draining the battery, you’ll have to pick through your plugins to find the culprit


Yeah its a tough call for this one. Like @premiumfrye said, you should first dig though your js to make sure there isn’t any leaky code. For the native side, you may have to open xcode/android studio to get some logs and see if there are any errors showing up.


Thank you both - I guess what I am really getting at is any guides to actually performing the tasks you note. How to dig into there / use the tools available and what I am even looking for to identify the issues / measure changes to know if it is better or worse. I’d already figured it was going to be javascript or native, but I have no experience tracking down anything within those / using the tools and hope someone might know of a good intro guide to the tools in the context of a web view based mobile app :slight_smile:


Hi there,

we also had to dig into that kind of tools because of a similar issue we are currently facing on ios.

Here are some interesting resources we have found for the occasion :

Dev tools :

Potential JS memory leaks :

Hope this can help you.


Thank you all so much.

One (hopefully) final point / question … we are noticing CPU stuck high and wondered if there are any good routes for tracking down the culprit for high CPU usage even when idle on android?