The deal with Android memory usage

Continuing this discussion of Android, the next question that came up was what the deal is with Android memory usage. I wondered the same thing at first, so that seems like a good topic to explain.

Prior to 2005, operating systems tended to use a set amount of memory, then what was left over was for programs. So a freshly booted system would have 2/3 of its memory left free, if not more. If you read my book and my blog way back at the turn of the century, you might have a lot more.

Fire up an Android, though, and you might only have 1/4 of the memory left, or less. Much of this is by design.

Modern operating systems regard unused memory as wasted memory, so they would rather put that memory to some use, then free it up if and when you need it for something else. You’ll notice that with a modern PC running a recent operating system. It’s not unusual for a freshly booted PC with 8 GB of RAM in it to be using at least half of it. Upgrade to 16 MB, fire it up, and you’ll see it’s still using half the available memory.

So Android spins up a lot of stuff when it starts, so it will be ready for you when you need it. It keeps track of what you use and don’t use, so when it runs out of memory, it finds the least critical thing, saves enough data to resume the process when it needs it, then flushes the process. If you need it later, it grabs that data and fires up the process again more quickly than spinning up from scratch.

You can observe this behavior easily by opening a web browser and opening several tabs. Switch back to the first tab, and there will be a delay, because it flushed it from memory. But it recovers pretty quickly.

This trick gives most of the benefit of swap space, without using swap space. It’s clever. It’s also why apps don’t have a close button. Just switch to something else; the app will terminate if and when a better use for the memory comes along. If not, no big deal.

So that’s the upside to Android memory usage. There can also be a down side.

Given that Android devices are usually sold by carriers who are subsidizing them, they have the same problem retail PCs have: bloatware. When you buy a phone, the phone maker loads some bloatware on it, and then the carrier shovels another helping of bloatware on top of that. You may not have a Facebook account and you may not want one, but if you have a mobile phone and didn’t hack it, there’s a pretty good chance there’s a Facebook app running on it, whether you want it or not. If not Facebook, something else you never use is, only because someone was willing to sling a dollar to someone in the supply chain before that device landed in your hand.

On a PC, you can just uninstall the crud and your PC runs faster, so people put up with it. So what happens when you do the same thing on Android? Well, when I went to uninstall Facebook, my phone told me it was a system app and I couldn’t uninstall it, though I could uninstall the last three years’ worth of updates to Facebook if I wanted.

I’m a security professional who once wrote a book about trimming down operating systems to the bare minimum. So you can imagine how thrilled I was at the choice between running a bloated 2013 Facebook app I wasn’t using or an insecure but less bloated 2010 Facebook app. Yep, the prospect of draining the sludge out of the p-traps under all of my sinks is more thrilling, and it’s not a close race.

And yes, I do have a Facebook account, but I don’t want it on my phone. Having my phone announce my whereabouts everywhere I go is bad security.

And while I don’t know this for certain, it seems like because Facebook was marked as a system app, Android was reluctant to spin it down, ever. So the apps I didn’t want were getting in the way of the ones I did want to run.

So that’s why people root their Android devices. When your name is root, you can uninstall these pseudo system apps. And, for some reason, Android doesn’t seem to do a very good job of spinning down these things like Facebook when you aren’t using them. So when you uninstall the bloat, the system runs better. Rooting lets you do a few other things too, but uninstalling junk and loading a custom ROM are the two biggies.

I take it a step further and load a custom ROM on it so I have an operating system, a barebones web browser, a Gmail client, a news and weather app, and not much else to start with. Do that, and it’s amazing how spry a three-year-old cell phone becomes. But that’s a topic for another day. Either tomorrow or the day after.

If you found this post informative or helpful, please share it!
%d bloggers like this: