Fix the Nexus 5 (5.0.1) Memory Leak Yourself
Issue #79729, “Memory Leak on Lollipop Crashing Apps,” has been tagged as fixed, and scheduled for a future release. However, that tag was added over a month ago, and many Nexus 5 owners (like myself) are growing frustrated with the lack of any sign of an OTA in the near future.
This is a very brief list of steps I’ve followed in order to mitigate the issue. It does not fix the underlying problem, but it does mitigate the biggest cause for noticing the memory leak: a long period of device uptime.
Root your Nexus 5 #
- Connect your Nexus 5 to your PC using a Micro-USB cable. Power off, and power on by holding down the power button and the volume down button. You should see fastboot.
- Download ClockworkMod Recovery Touch and the Android SDK Tools
- In the Android SDK Tools, install only the platform tools (ADB) and come back here.
- Using a command prompt or terminal, navigate to the
platform-toolsfolder. $ ./fastboot oem unlock- Unlock your device’s bootloader, if you haven’t already.$ ./adb reboot bootloader- Reboot into the bootloader. You need ADB enabled from the first reboot after a userdata wipe to get here.- Copy the ClockworkMod Recovery image to the
platform-toolsfolder. $ ./fastboot flash recovery recovery-clockwork-touch-6.0.4.5-hammerhead.img$ ./fastboot reboot bootloader- Using the on screen volume up and down buttons to select menu options, and power to click, boot into recovery.
- Download the SuperSU flashable zip and place it in the
platform-toolsfolder. - On your Nexus 5, tap ‘install zip.’
- On your Nexus 5, tap ‘install zip from sideload.’
$ ./adb sideload UPDATE-SuperSU-v2.45.zip- You should be rooted. Tap go back twice and hit ‘reboot system now.’
Install the helper app #
- Install Auto Reboot (Root Only) and open it.
- You should be prompted to grant superuser permissions to Auto Reboot. Grant them.
- Schedule a daily reboot just before you wake up. I’ve picked 5:30am, personally, but try to shift it such that you will wake up shortly after, and that any missed calls or notifications will come in after the reboot. This ensures that you’ll wake up to any important notifications, but moves the reboot time closest to when you’ll start using your device.
Mitigate the memory leak further #
The issue with the memory leak stems from certain parts of the system allocating large amounts of memory and not releasing them. One of the biggest culprits is overview, the renamed recent apps pane. Swiping quickly through the entirety of overview will cause a spike in system ram usage, causing the problem to reoccur if enough apps are open.
Mitigate use of this feature by only switching to the most recent stack of cards (say, the last five), or by opening apps from a launcher instead.
Conclusion #
With these precautions in place, I’ve yet to run into a time when my device has become unusable and required a reboot through daily use. This is far from ideal, but it does at least bring experience dramatically up from rebooting only when everything stops working correctly.
To a bright 5.1 OTA future, I hope your android experience improves a bit using this until then.