Task Managers and your Hero


  1. romeosidvicious

    romeosidvicious Well-Known Member

    I have explained some of this in various threads and thought it would be nice to have a single thread where I could try and do a better job explaining memory management on the Hero (and all other Android based phones) and why a task killer isn't necessary in day to day use. I am a Linux geek for a living. I work in high performance computing and have been working with Linux for better than ten years. The following is not opinion based on reading message board posts it is an explanation, without getting too technical hopefully, of how memory management actually works on your Sprint Hero. I will include some specific notes for those who have rooted their phones at the end of this post.

    Before I jump into memory management let me start by saying I do have a task killer installed. I do not use it to auto-kill apps nor do I kill all applications. Doing these things can have unintended consequences if you don't know what you are doing and haven't added the right processes to the ignore list in your task killer. So before you even install a task killer you need to understand that killing all running processes, the ones you have access to at least, can cause you not to get text messages, your alarms not to go off, and even phone calls to be delayed more than they are already. So if you read this and decide to install a task manager remember that auto-kill and kill all processes is not the best way to use these tools.

    With that disclaimer out of the way the first thing I feel should be be stressed is:

    YOU ARE NOT USING A WINDOWS DEVICE

    That is important. Many folks, including myself, come to our beloved hero from a WinMo world where killing apps affected performance in a big way. With one caveat this is not the case with Android. The caveat is this: Some applications do not sleep properly or can have memory leaks and that is where having a task killer comes in handy. Outside of the rare case of misbehaving apps the day to day use of a task killer is pretty much a waste of your time.

    The second point I want to make is that your reported free memory is not accurate. Not a single task killer on the marketplace properly reports usable memory for your device. Remember the first point? The one in bold? Good. That's why you don't see accurate reporting of free memory on your device. Your Sprint Hero is a Linux based device and is designed to multitask unlike WinMo and the iPhone. One of the ways Linux speeds up multitaksing is to eat all the memory that it can at any given in time. It stores as much as it can of any process in memory so it can be accessed faster for you. This leads to it appearing that you have a very low amount of free memory when in reality you do not. Bits are unloaded whenever anything else is called and that happens at the same speed as it would if the memory were technically empty. An example of this is my workstation at the office. On boot, after login, running nothing but a terminal application, my workstation shows between 12.5GB and 14GB RAM used (yes GB). After starting a media player, two browsers (chrome and firefox), my usual terminal application, tweetdeck, whistlr, pdigin, Eclipse PDT, and usually MS Office 2k7 via Wine I can go back to the same terminal window I opened at the start of the session and see between 12.5GB and 14GB RAM used. Nothing has changed at all and I have apps running that are known to be heavy on memory usage. The only time I see performance drop on my workstation is when I hit the disk IO to heavily. While that much RAM isn't synonymous with the Hero it is a good example.

    If a process isn't actively using the CPU then it isn't affecting your battery or degrading your performance. Unlike WinMo a long list of running tasks doesn't mean much on Android. The apps that are actively using the CPU are sleeping. They have resident bits in RAM and only the bare minimum needed to keep them alive isn't swapped in and out of memory. A sleeping app is not accessing RAM, CPU, or network. It can run in the background for days without having any affect on performance. So the list of "running" apps you see with a task killer isn't a list of active apps but rather apps waiting patiently and being behaved until you need them and then they can snap right into being active for you.

    Because of the way Linux manages RAM using a task killer when you don't have any apps misbehaving will degrade your performance noticeably. This is because everything has to be loaded back into RAM when you start your application again. The "sleep" described above is negated when you kill all of your applications thinking that you will gain performance by "clearing" out RAM. So while in the WinMo world you wanted as few apps running as possible the same is not true in the Android world and your Hero is an Android device! It's not an easy mindset to change. I am a Linux geek for a living and I still grabbed a task manager on my first day and started killing running apps. I had to get my head around my phone actually being Linux. I can imagine for someone who doesn't come from my background that this is even harder to grok.

    Now there are apps out there that don't behave properly. This is why I still have a task killer installed. Well I say that there are. I honestly haven't had one on my phone yet and I do a lot of installing and uninstalling apps from the market because I am a geek and like to fiddle. It may be hard to track down an app that is misbehaving or has a memory leak but Spare Parts is a good place to start. If you have an app that you know you haven't been using and it shows as using a bunch of memory compared to other apps you use about the same amount then it's likely you got a hold of a problem app. The answer, in my opinion, is not find a task killer that will kill the app over and over again but to uninstall the thing. If it has memory issues who knows what other problems there are in the code. I have learned through years of trial and error not to trust apps that have memory leaks. How you handle broken apps is up to you but my recommendation is just to get rid of the damn things and then you don't have to worry about it going forward. But like I said I keep a task killer installed just in case.

    The one thing I feel I need to make sure is said before I close this little diatribe out is that there is one place you will see apps fight for memory and that is when you boot your phone. Once everything has loaded and grabbed all the data everything needs apps will settle in to sleep and stop using RAM. The more crap you have checking the network for data the longer it will take your phone to settle into what it perform like after a boot. So if you have a dozen or so widgets that check the weather, to do lists, sports scores, Obama's horoscope, you dog's biorythms, and so on then any performance issues you see on boot are you fault and no task killer in the world will help you. I'm just sayin'....

    I have seen some claims that battery life improves with the use a task killer but unless you are running a lot of network applications I don't see it happening based on the way Android is designed to let apps sleep. I know I haven't seen much difference than the reported life of folks that use a kill all task killer three or four times a day. Based on what I know about Linux I can safely say that I don't see any real reason for using a task killer to ever kill all applications on a Hero. You might gain a momentary bump in battery life by not having an app check something here and there but you would lose it again when you have to load everything every time you start an app. And the degrade that you would have in performance just isn't worth a few minutes of battery life in my opinion.

    For users with rooted phones:
    The following won't affect anyone that hasn't rooted their phone.

    If you aren't using an app then remove it. This goes for all the preloaded applications from Sprint. You can increase performance by making memory available to load the actual stuff use. You should still see "free" memory being what you might consider to be low coming from WinMo but it's full of the goodness you want and use.

    REMOVED SECTION ON SWAP BASED ON FURTHER RESEARCH

    That about sums up what my mind can get out at the moment. Please feel free to ask any questions you have and I'll try to answer them if I can and if I can't I'll try to find you an answer. I hope this has been helpful.

    Advertisement
    :
  2. stinky

    stinky Well-Known Member

    Good guide. Coming from WinMo I was having a hard time believing that I could have apps running for days and not get performance issues.

    I use my task manager the same way, only had to use it once, I had an app that was causing some serious lag and wouldnt close out. I have since uninstalled it. I havent had any problems yet.

    Also +1 on having more free space to work with. I usually find a few apps to get rid of before I get new Apps.
  3. steveopolis

    steveopolis Member

    I apologize if this question seems simple minded, but what would be the best or proper way of testing whether the app a person downloaded is causing issues? Either it be memory leaking or RAM usage?
  4. nick325i

    nick325i Well-Known Member

    There are applications that hang or don't exit properly when you use the back button. This is a reason to use a program of such nature. I use one that I initialize myself called "Close Everything". 1 or 2 times a day just to make sure that a program which stopped working, that didn't force close will fall to the wayside. Whether or not it actually helps with anything, I don't care much because if it errored out, the OS probably isn't handling it properly anymore.

    Nice guide Romeo!
    permazorch likes this.
  5. TF1984

    TF1984 Well-Known Member

    Romeo,

    You mention "Swap Space" for rooted users. I looked lightly into this but all I saw warned it may do more damage in the long run then good. I am not very familiar with all the how tos, and what ifs.

    Could you give instruction on Specifically setting this up? ...Or link to a guide that explains it?

    Also, I am still having trouble accepting the claims that Linux operates the way you and others have described. To be honest, sometimes when I'm typing or scrolling through screens, etc. etc. I get poor system performance. If I open ATK and kill running apps, free memory from say 29MB to 65MB, my performance is substantially increased.

    Same thing occurs towards the end of every day. In the morning or after a reboot, Free memory is around 65-75MB, (I have Adv. Task Mana auto-end every 30.) but later on in the day, with the same "Excluded" apps being the only ones running, my free memory might be 29MB. A reboot is the only way to recover the lost or missing memory. And this is an app to app comparison:

    After fresh reboot and Auto end all but 6 excluded apps: 65-70 MB
    After 6-10 hours of operation and Auto end all but 6 excluded apps: 29MB, why?
  6. lekky

    lekky Lover VIP Member

    Brilliant, I'd say there is a very strong case that this should be moved out of the Sprint Hero section and stickied in a more general forum, such as android apps section.
  7. pking

    pking Well-Known Member

    I'd recommend that you do not use swap on an Android device, especially the Hero or similar.

    When using SWAP, Android relies on the kernel to determine what, when and how much of a process to swap - this also means that *any* application can be moved to swap, including the important stuff like phone dialer, messages app, alarm clock, etc. While these apps will still work, the phone will crawl or even hang as these apps are retrieved from the SWAP device.

    When using SWAP on an Android device, there are only two options for where to put it: SD card memory, or local flash memory. In my testing of both, there's little noticeable difference in speed. Both are extremely slow compared to system memory.

    Using SWAP on SDcard memory also prevents you from removing your card while the phone is operational - you'll run into the same issues you'd see if you removed the SD card while Apps2SD was installed - the phone can no longer get to the data, and will hang or crash hard.

    That said, here's what I've found in my testing of SWAP space:


    SWAP on SD Card, 32MB, default 'swappiness' -

    in this configuration things work OK for some time, usually a day or so. By this point, enough apps have opened, closed, or the phone has slept for a period long enough that the system determines it should move them to swap. The phone starts to get *extremely* sluggish at this point as data for 70-80% of common system tasks have been swapped out while the phone or processes were sleeping.


    Swap on system memory, 32MB, very low 'swappiness'

    After failing to get the phone usable using SD Card swap, I hypothesized that the SD Card bus was simply too slow for swap to be of benefit. The alternate choice was to try the on-board system memory which should technically be faster as it's all internal hardware and busses.

    This was a total pain-in-the-ass to configure - basically this consists of making a file the size of your desired swap space, making it system read/write able, and linking a special device node to the file so the swap system can use it. This is similar to the 'page file' in Windows in that it resides as a file on the disk instead of in a seperate specialized partition. There's no difference in speed accessing the 'file' based SWAP vs the partition based SWAP.

    The 'swappiness' factor should help to keep 'common' stuff from getting swapped out, but as the system RAM is fairly limited, in practice this means that nearly *everything* running on the phone gets swapped out at some point as another app requests it's resources. Important stuff, like Sense UI or the phone dialer.

    With the jargon and geekspeek out of the way - the bottom line is that it performed *exactly* the same as swap on the SD Card. It turns out that the on-board memory isn't really much faster than the SD Card bus. Latency may be a little better, but any time the SWAP was touched, the phone crawled like a snail.

    I decided to nix the SWAP at that point and let Android handle the memory as it pleased - my phone has been 100% more stable, and always responsive since doing so.

    In conclusion - SWAP would be great if the swap space could be accessed at speeds anywhere near the system RAM, but unfortunately there's no such place on the Hero (or other Android phones for that matter). SWAP works out great for about a day, usually less, and then the phone becomes basically unusable as the day-to-day stuff gets swapped out as well.
  8. TF1984

    TF1984 Well-Known Member

    @PKing - Swap is not the same as Apps2sd principle right?

    So I should not swap, what's your recommendation for apps 2 sd?
  9. pking

    pking Well-Known Member

    No, SWAP is for memory management.

    Apps2SD just changes the storage location where all your apps are stored to a partition on the SD card instead of the local system flash memory.

    There's been great debate on the benefits / drawbacks of Apps2SD but IMO it boils down to this:

    The benefits:

    Apps2SD is really useful if you have so many apps you do not have enough space to store them on the phone memory. Using the SD card to store the apps gives you basically unlimited storage space (as many apps as you can fit until your SD card is full)


    The drawbacks:

    With Apps2SD working, you're tied to your SD card - if it should fail, your apps are gone. If you should want to remove the card for some reason, you have to power-off the phone to do so.

    Applications like Nandroid *do not* always backup the SD card partition, and may not backup your apps. Other means may be necessary to backup your applications, and there will often be problems on restoring from a backup that doesn't contain them.

    The SD Card bus, while comparable in speed to the on-board memory, does introduce some latency - apps will take ever-so-slightly longer to load from your SD card.

    [edit]
    flipzmode from XDA has a post in his FreshRom thread that describes some of the issues with Apps2SD as well:

    http://forum.xda-developers.com/showpost.php?p=4942088&postcount=2

    Personally, I've found that the available space on the phone is plenty for the apps I use, and it's not worth the risk involved to use Apps2SD as I tweak around in my phone *a lot*, and have used Nandroid restore more times than I can count ;)
  10. TF1984

    TF1984 Well-Known Member

    hmmm.. Okay, so it's beginning to make a bit more sense. So swapping is like trying to use an sd card as RAM, which is crazy. And apps2sd is only moving apps to memory of card rather than physical memory of phone.

    Cool.

    Now to do apps2sd, I just boot in recovery mode, select partition to ext+fat+_swap or whatever, then reboot? THat's it, there's no setting I need to adjust somewhere to make it actually do the apps2sd?

    Are my current apps going to stay as they are or will they be pushed to sd?
  11. pking

    pking Well-Known Member

    I've only ever used Apps2SD on a fresh install, I'm not sure what the steps are, but this isn't the thread to ask about it in, there have been countless posts on setting up Apps2SD elsewhere.
  12. TF1984

    TF1984 Well-Known Member

    okay thanks. I am unfortunately lot able to find the set up threads. I'll just keep wandering.
  13. romeosidvicious

    romeosidvicious Well-Known Member

    Admittedly I have not done this on my phone and my thoughts were based on experience with Linux and not with Android. I have removed this section after doing some research based on posts in this thread.

    Try this. Kill your apps like you usually do, set your phone down and don't mess with it at all, come back in thirty minutes and check your free RAM. The instant you kill something it is out of RAM and that RAM is free. Linux then begins looking for what it can to fill that RAM. If you set all of your email to manual and turned on airplane mode you would still see your RAM usage grow after killing everything. I am willing to bet that at least part of your performance gain is a placebo effect from being so used it happening on other devices. You may even see some right away for a minute that will go away as apps start swapping in and out of memory. Any snapiness you see in Sense is simply because more of Sense is loaded into RAM and nothing else has requested the space yet. I expect any measurable performance increase is short lived.

    The problem is that there is no missing memory. When you are looking it right after boot nothing has loaded itself into RAM yet. Linux keeps everything it can in RAM constantly. This doesn't mean that RAM isn't available to other applications it means that if the original application needs the data it will be faster.

    As explained it is because everytime something is accessed Linux leaves it in RAM in case it is needed again. I cannot stress enough the number you are looking is not accurate at all. It shows how much RAM Linux hasn't loaded stuff into not how much is available for the OS and apps to use. Linux is quite happy to overwrite stuff in RAM so the 29MB free is not really how much you have available to use. This is why I stressed that this is not windows. Memory management is completely different. I have tried to explain it as simply as possible and without being too technical.
  14. romeosidvicious

    romeosidvicious Well-Known Member

    @pking - Thanks for the heads up on swap. I hadn't set it up on my phone and your post got me researching and lo and behold it's not a good idea for this phone at all. Thanks very much for your post and the information you presented. I removed the swap suggestion from the OP!
  15. romeosidvicious

    romeosidvicious Well-Known Member

    Some apps aren't designed to actually exit when you hit back but just to sleep in the background. That's why I didn't bring those scenarios up. The only time you should be worried is if you are getting high awake times. If you have two dozen processes and low awake time then there's likely not an issue with the apps regardless of whether or not they exited when the back button was used.
  16. nick325i

    nick325i Well-Known Member

    I was talking about the programs that are suppose to exit with the backbutton and don't do it properly.
  17. romeosidvicious

    romeosidvicious Well-Known Member

    Right on! I don't think I have come across any yet, at least not since I started paying attention, so thanks for adding that knowledge. The more we know the better we can tweak the hell out of this phone!
  18. keefuss

    keefuss New Member

    Just wanted to take a few seconds to say THANK YOU for your posting. I am not a Linux professional and I downloaded "Taskill" on my Hero yesterday. I didn't like the feeling ....so I un-installed it. I'm glad I did in retrospect. The "sleep" concept of linux is cool, and your article has definitely helped me get my head around the concept.

    I'm so wanting to root my damn phone but I haven't seen any accounts of "How to" that even match one another. I'm hoping I might reach out to somebody locally on Craigs List to let them "$do$ it" for me.

    Know any linux champions in the Charleston, SC area?
  19. TF1984

    TF1984 Well-Known Member

    @Romeo

    Okay so After rambling with you I have accepted your claim. I removed my paid Task Manager and I have received amazing battery life sense.

    Unfortunately I also Rooted and Rom'd my phone so there's no way to know how much life was due to not running the TM and how much was saved since Fresh Rom removed that obnoxious auto-starting PEEP and Stock apps.

    Anyhow, credit where credit is due... to you. thanks.


    Hmmm... Just checked my awake time and I'm at 67%. That's pretty high consifering I've never been over 20%.

    Anyway, my battery is still over 60% with 67% awake time and I've been uncabled for 8 hours. Wooohoooo. Who cares if my phone sleeps if I get this kind of battery life!
  20. momoceio

    momoceio Well-Known Member

    +1 for using the word "grok" haha, I don't hear many people say that.

    Great guide as well!
  21. romeosidvicious

    romeosidvicious Well-Known Member

    Well I am a nerd. I say all sorts of weird crap when I speak aloud and it spills over into my writing. The logic portion of my brain works like a bash script! Anyway thanks for the props!
  22. romeosidvicious

    romeosidvicious Well-Known Member

    You know what sucks for me? I work in a basement and get no bars so my battery life sucks no matter what I do. Middle of January we are supposed to get Sprint repeaters here though so I'll actually be able to test other than on the weekend.

    Well battery life isn't the focus of my diatribe but it would have some effect. I really just wanted a place where all the explanations I had given were in a single place and folks could ask more and such. I would bet Fresh had more to do with battery life than me and my little post.

    And thank you for engaging! I am amazed at how many people won't discuss technical issues.


    I will have to think to check wake time this weekend. I have mine always on when plugged in and it's plugged in 9+ hours a day so my awake time sucks.
  23. klau25

    klau25 New Member

    thanks a lot romeo, this makes so much sense. i can't believe the past few days i had been killing appls endlessly. i just can't understand why all these different appls kept showing up on the task bar while i never even opened them once. this info is so useful. it was driving me crazy thinking that the navi program is taking up all the memory and is wasting my battery life. i almost thought i had a defective phone. now i know why it keeps showing up in the tast bar.
  24. TF1984

    TF1984 Well-Known Member

    I think it's my weatherbug Elite app. I didn't have any trouble with sleeping prior to my Fresh Rom installation, and I had weatherbug then.

    But when I noticed the awake issue, i started ADv. Task Mgr and the only app that seemed it could be stopping the sleep was weatherbug. I killed it and the phone slept. But it started itself again and again the phone would not sleep. I just uninstalled it to see if my sleep issue is resolved. It sucks since this is a paid app and I am past the refund period. Not to mention, I really LIKE weatherbug elite and it's widgets.
  25. esoteric1311

    esoteric1311 Member

    I'm by far a linux champion, but found this guide worked for me in rooting a phone in under 10 minutes.

    [GUIDE] How To Root The CDMA Hero (Windows) - xda-developers
Loading...

Share This Page