Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I'm really confused about Android memory management.

I just read here that killing apps by swiping from recent list or using task killers won't save your battery but drain more because this cause the OS to load the apps all over again next time you launch it or startup by themselves. They also said the actually thing we should worry is CPU usage, not RAM usage.

Is that mean using too much RAM doesn't drain battery? As RAM is a hardware, holding something on it shouldn't drain battery? What if I was playing Temple Run and just press home button so the app will load faster next time I launch? Or should we just press back button until the app exit as we always do? I've also searched the internet but some said it would drain battery as it sits on RAM, some said there is no difference between RAM holds actual data or nothing. Should we let go of our app-killing habit and just feel relax?

Some precise answers would be greatly appreciated. Thanks. :)

share|improve this question
    
Your RAM is one of your least power-hungry pieces of hardware... –  Brian S Apr 9 at 15:18
    
Your temple-run example might not be the best: as games can memory-hungry they either will be OS-killed rather quickly, or pro-actively will save the important data away when send to the background. It might load a little bit faster in that case because some small part is still loaded, but the game data will probably need to load anyway. A better example would be a simple twitter client: that might fit nice and cosy in your RAM until you need it again. –  Nanne Apr 14 at 6:37

6 Answers 6

up vote 19 down vote accepted

I doubt that there is a direct correlation between battery consumption and RAM usage. The hardware doesn't know which RAM cells contain 'used' data and which not. So there can be no difference in battery consumption on that level.

But I think that one could say that unnecessarily killing Apps causes a few extra CPU cycles when those Apps have to be re-started and therefore "uses more battery".

And yes, you definitely should let go of your app-killing habit. In most cases, Android is capable of managing the system's resources quite well and you shouldn't bother with manually killing Apps. They definitely won't drain more battery if they just idle around and consume some RAM. Of course, if those Apps are constantly using the CPU, they will drain battery (but this is usually a sign of a bug within the App or a badly implemented App).

share|improve this answer
    
On the other hand, there are misbehaving apps that wake up and don't go back to sleep in a reasonable amount of time. These are the apps that can very likely be causing battery woes. You can take a a look at them using Wakelock Detector –  Ehtesh Choudhury Apr 8 at 17:08
    
That's why I said that Apps using constantly the CPU are usually faulty or at least badly implemented. Note that I would not recommend using apps like Wakelock Detector as this functionality is now part of Android (with 4.4 IIRC). –  Flow Apr 8 at 18:49

Think of RAM like a paper notebook. You can write data into the book (with a pencil), and you can erase those data and replace them with new data, but the book's always the same weight. The book doesn't get any heavier, whatever you write in it. The same way, with current RAM technology, the battery use of the RAM is fixed, regardless of what (if anything) is stored in it.

From Android's point of view, it doesn't matter whether you leave an app with the home button or the back button. Pressing the back button doesn't kill an app or remove it from RAM. Swiping an app out of the 'recent apps' list doesn't kill the app or remove it from RAM. The only difference it makes is changing what the app shows you next time you launch it: the screen you were on before, or the main/first screen of the app.

Imagine you have a notebook (as before), and a big bookcase with lots of reference books. You can't carry the reference books around with you, so if you need to know about a subject, you have to copy the information out of a reference book into your little notebook. When you run out of space in the notebook, you use your eraser to wipe some information you don't need again, so you can copy more information into it.

All this copying is tiresome. So once you've copied some information, you want to keep it in your notebook for as long as you think you might need it. You keep track of what information in the notebook you're using right now, and what information you use often, and what information you haven't used for a while. When you want to make space, first you erase the information you haven't used for a while. If you haven't got any of that left, then you erase some information you use often but not right now. Only if you're really desperate for space (maybe there's one big subject that takes the whole notebook) do you erase the information you're using today.

This is exactly what Android's doing with your RAM. The big bookcase with reference books is like your phone's internal storage: you can't use it directly (because the books are printed, not written with pencil), so it's expensive (it takes time and energy) to copy data into your notebook (RAM) to work on.

A task manager app is like a schoolteacher who thinks your notebook looks untidy with all those pages of notes you're not using any more. The schoolteacher comes along every so often and erases whole pages of notes. This is unnecessary, because it doesn't make the book any easier to carry around: the book weighs the same regardless. Not only that, the schoolteacher doesn't know which information you use most often - he might have a vague idea, but he doesn't know as well as you do - so sometimes when he erases information, the cost is an extra trip to the bookshelf, which you wouldn't have needed otherwise.

Thinking about it this way, it's easy to answer your question. Using more RAM doesn't use any more power directly. A task manager app can make you use more power, because you're having to copy things from internal storage to RAM that you wouldn't have had to otherwise. In the same way, a single RAM-hungry app costs you twice: first you have to write all of that app's information in the notebook, and then when you finish with it, there's a lot of information that you had to erase (to make space), which you have to copy from the bookshelf again.

share|improve this answer
    
Thank you for your noob proof explanation :) –  Min Naing Oo Apr 8 at 9:02
1  
Haha, I like the analogy (+1). (Although, technically, if you write something the notebook it will weight just a bit more...but I'm being too critical.) Something else to note for @MinNaingOo is that, if you're running a Task Manager, that Task Manager is also using power cycles (AKA CPU) to do what it needs to do. Hence...more battery is being used. –  JasCav Apr 8 at 15:29
2  
It might also be worth mentioning the garbage collector. Your notebook doesn't just contain information you might need again. It also contains "garbage" - information you'll definitely never need again. This is because android is lazy, and doesn't even erase the garbage until it needs more memory. When you are low on memory, it will collect up this garbage to save some space. If you are low on memory often, then it will collect garbage more often, and use more battery. –  James_pic Apr 8 at 15:30
    
@James_pic That's what the fourth paragraph is about. I don't want to additionally bring the within-app GC into it, as that's a bigger topic only relevant to programmers. –  Dan Hulme Apr 8 at 15:39
    
The only difference it makes is changing what the app shows you next time you launch it - Ehh, mostly true, but not always. "Back" tells the app, "okay, I'm done", so it can do extra cleanup immediately. I killed my data plan one day when I accidentally hit "Home" instead of "Back" from Google Maps - it kept updating in the background. –  Izkata Apr 8 at 17:08

As the article explained to you, it doesn't matter how much stuff is loaded into the RAM, so that's completely okay if you don't close the applications that are idle. But if the app constantly does some activity, like syncing some data, or downloading, or even recording sound, it would drain your battery, because it uses the CPU, which sucks the energy from your battery, in that case, closing the apps would be a good thing to consider. Otherwise, if you're sure that the app will not perform constant activity in the background, then you shouldn't worry about it being stored in the RAM, it's just the same as storing your files in SDCard (I mean SDCard doesn't use battery, right?). So just relax :) I guess temple run doesn't do any activity in the background, so don't worry to leave it in the ram. Hope I explained to you. Cheers!

share|improve this answer

There is a big difference between iOS and Android. iOS freezes the apps, Android doesn't. The logic he explains in that article cannot be applied to Android, where some apps will drain your battery while in the background. If you care about this, use something like Greenify instead of a task killer.

share|improve this answer
    
What is the advantages of freezing app? –  Min Naing Oo Apr 8 at 10:24
1  
@MinNaingOo, A ”bad” app, cannot make a user think the iPhone battery is failing. So stopping the user blaming apple. –  Ian Ringrose Apr 8 at 10:38
1  
@MinNaingOo Read this addictivetips.com/android/… –  Hallucynogenyc Apr 8 at 10:47
1  
@Hallucynogenyc I've been using Greenify on all of my android devices even though I didn't know much about it's advantages. Thank you for the link :) –  Min Naing Oo Apr 8 at 11:08
1  
@MinNaingOo Read this stackoverflow.com/questions/11417837/… –  Hallucynogenyc Apr 9 at 10:40

Answering the question of the title: "Can using too much RAM drain battery?"
(Not your "real" question, but possibly useful for others interested in the questions title.)

Yes, when too much RAM is used by apps or services trying to run at the same time, the system may need to kill some of them very frequently, even multiple times per second, and restart them soon as they are needed by something else.
That is using lots of CPU cycles, and thus some battery capacity.

Note that is not a normal case, like "not killing some apps manually", it's a "very broken" state - but I have seen it happen, seems to be related to many services interfering and competing for memory.

share|improve this answer

Only if the freed space is overwritten with zeros. Otherwise the bits in the memory weight the same as before.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.