Welcome to the Android Central Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 13 of 13
Like Tree27Likes
  • 18 Post By Golfdriver97
  • 4 Post By Golfdriver97
  • 1 Post By Golfdriver97
  • 5 Post By Aquila
  • 1 Post By Golfdriver97
  • 1 Post By Almeuit
  • 2 Post By UJ95x
  • 4 Post By Hquinn81
  • 2 Post By Golfdriver97
  • 1 Post By drenfree
  • 1 Post By Golfdriver97
  1. Thread Author  Thread Author    #1  
    Golfdriver97's Avatar

    Posts
    31,113 Posts
    Global Posts
    31,611 Global Posts
    Carrier
    Pure Nexus/Franco Kernel

    Default [Guide] RAM and Android

    RAM and Android; Android and RAM. Sooner or later this will come up. So, let's get the discussion under way.

    In a very rudimentary way, Android works like this:
    Memphis turns his device on from a powered down state, Android loads everything up, and is ready to go. He then opens App #1 for the day. After using it for a few moments, he opens App #2, uses it, and then goes to the homescreen and goes about his day.

    A little later, he opens up App #1 again, and it loads a bit faster.

    'Switching Apps

    Instead of using swap space when the user switches between apps, Android keeps processes that are not hosting a foreground ("user visible") app component in a least-recently used (LRU) cache. For example, when the user first launches an app, a process is created for it, but when the user leaves the app, that process does notquit. The system keeps the process cached, so if the user later returns to the app, the process is reused for faster app switching.'

    http://developer.android.com/trainin...es/memory.html

    Memory management

    Android manages the apps stored in memory automatically: when memory is low, the system will begin killing apps and processes that have been inactive for a while, in reverse order since they were last used (oldest first). This process is designed to be invisible to the user, such that users do not need to manage memory or the killing of apps themselves.[67][68]However, confusion over Android memory management has resulted in third-party task killers becoming popular on Google Play store; these third-party task killers are generally regarded as doing more harm than good.[69]

    http://en.m.wikipedia.org/wiki/Andro...rating_system)

    Here is the why: The device Memphis was using had App #1 loaded in RAM. Android did not have to spend the extra time (which can be equated to battery power) loading the app from the internal storage and launching.

    Now, not everyone uses just one app, we open several. The OS needs to have certain things loaded to help apps and related files and operations executable (think images, and radios). This done multiple times, eventually will bring RAM to nearly full.

    'What happens now?'

    RAM is nearly full and Memphis really needs to open up App #3. Android will look at the recent apps and sees that App #2 that Memphis opened at the beginning of the day, and hasn't been used since, can be killed to make room for App #3 to launch. App #3 then launches without a problem.

    'Ok, so what is the big deal?'

    The big deal is here is where users start to diverge into two main groups: Those who use task killers and those who do not.

    Empty RAM is wasted RAM

    The classic rule of thumb for Android. To add to it, misspent RAM is almost as bad. Take for example, when I got my S3 from Sprint. One of the widgets was from the Associated Press. Always kept up on RAM usage, even though I never opened it. In fact, I didn't know I had it until I had the device for a month. All that time, AP was sucking up RAM (albeit a fairly small amount) that could have been used elsewhere. May not seem like much of a problem, but take a device that is very inexpensive, and that extra RAM sucked up is a bad thing. Also, add all the other garbage that is bloat that not many people use, and the misspent RAM adds up, and quickly, even on a high end device.

    Android has greatly changed since the days of old. Most people would agree that Gingerbread on most devices was, at best, horrible at RAM management. Back then, automated task killers were almost a necessity. But for the most part, Android can do it quite well on it's own.

    'So, what about Task killers?'

    Task killers can be as hard on the battery as they would do good. Many kill almost any running task, which Android then restarts because it needs it, spends battery firing up the CPU, bringing it out of memory and loading it. The Task killer then sees it again, and kills it. This brings about an endless cycle, thus draining the battery more than it should be drained.



    Image taken from:
    http://developer.android.com/referen.../Activity.html

    To determine which processes should be killed when low on memory, Android places each process into an "importance hierarchy" based on the components running in them and the state of those components. These process types are (in order of importance):

    1. A foreground process is one that is required for what the user is currently doing. Various application components can cause its containing process to be considered foreground in different ways. A process is considered to be in the foreground if any of the following conditions hold:

      There will only ever be a few such processes in the system, and these will only be killed as a last resort if memory is so low that not even these processes can continue to run. Generally, at this point, the device has reached a memory paging state, so this action is required in order to keep the user interface responsive.
    2. A visible process is one holding an Activity that is visible to the user on-screen but not in the foreground (its onPause() method has been called). This may occur, for example, if the foreground Activity is displayed as a dialog that allows the previous Activity to be seen behind it. Such a process is considered extremely important and will not be killed unless doing so is required to keep all foreground processes running.
    3. A service process is one holding a Service that has been started with the startService() method. Though these processes are not directly visible to the user, they are generally doing things that the user cares about (such as background mp3 playback or background network data upload or download), so the system will always keep such processes running unless there is not enough memory to retain all foreground and visible process.
    4. A background process is one holding an Activity that is not currently visible to the user (its onStop()method has been called). These processes have no direct impact on the user experience. Provided they implement their Activity life-cycle correctly (see Activity for more details), the system can kill such processes at any time to reclaim memory for one of the three previous processes types. Usually there are many of these processes running, so they are kept in an LRU list to ensure the process that was most recently seen by the user is the last to be killed when running low on memory.
    5. An empty process is one that doesn't hold any active application components. The only reason to keep such a process around is as a cache to improve startup time the next time a component of its application needs to run. As such, the system will often kill these processes in order to balance overall system resources between these empty cached processes and the underlying kernel caches.


    http://developer.android.com/guide/topics/processes/process-lifecycle.html


    Depending on the application, it may restart on it's own, due to coding in the app. Take for example the Associated Press widget that I had. In that instance it would be better for me to disable it as opposed to a task killer killing it all the time.


    The down side to task killers is they are often non discriminatory in what should and should not be killed. Let's say for example, John Doe uses Task Killer Extraordinaire and uses it to kill Nova Launcher (I checked this against a common task killer, this is possible). This will cause errors to come up, and he may not know why.

    Something that has to be kept in mind is most users who have an Android will probably equate it to a Windows PC. In the subject of RAM, Android is not Windows. Windows likes to have RAM somewhat empty on standby. That is the way Windows OS works; more RAM is typically better to an extent (there is a critical mass idea of after a certain point, the extra RAM becomes irrelevant). Android, conversely, likes filling it, so it can use the cached data to reload the application easier.

    Memory management

    Since Android devices are usually battery-powered, Android is designed to manage memory (RAM) to keep power consumption at a minimum, in contrast to desktop operating systems which generally assume they are connected to unlimited mains electricity. When an Android app is no longer in use, the system will automatically suspend it in memory – while the app is still technically "open", suspended apps consume no resources (for example, battery power or processing power) and sit idly in the background until needed again. This has the dual benefit of increasing the general responsiveness of Android devices, since applications do not need to be closed and reopened from scratch each time, and also ensuring that background applications do not consume power needlessly.[

    http://en.m.wikipedia.org/wiki/Andro...rating_system)
  2. Thread Author  Thread Author    #2  
  3. Thread Author  Thread Author    #3  
    Golfdriver97's Avatar

    Posts
    31,113 Posts
    Global Posts
    31,611 Global Posts
    Carrier
    Pure Nexus/Franco Kernel

    Default Re: [Guide] RAM and Android

    Reserved
    esteem viejo likes this.
  4. #4  
    Aquila's Avatar

    Posts
    11,710 Posts
    Global Posts
    11,945 Global Posts
    Carrier
    Assassin 'Droid

    Default Re: [Guide] RAM and Android

    Thank you so much for putting this together. I seriously wish that people were required to read this and recite it back in order to download a task killer, battery saver, blah blah, you get the idea Let the OS do it's job!

    This part: This process is designed to be invisible to the user, such that users do not need to manage memory or the killing of apps themselves.[67][68] However, confusion over Android memory management has resulted in third-party task killers becoming popular on Google Play store; these third-party task killers are generally regarded as doing more harm than good.[69]

    I'd like this part to be bold, multi-colored, underlined and font size 500,000,000. I want every android user from now until the end of time to be able to see that section from space.


  5. Thread Author  Thread Author    #5  
    Golfdriver97's Avatar

    Posts
    31,113 Posts
    Global Posts
    31,611 Global Posts
    Carrier
    Pure Nexus/Franco Kernel

    Default Re: [Guide] RAM and Android

    Quote Originally Posted by Darth Spock View Post
    Thank you so much for putting this together. I seriously wish that people were required to read this and recite it back in order to download a task killer, battery saver, blah blah, you get the idea Let the OS do it's job!

    This part: This process is designed to be invisible to the user, such that users do not need to manage memory or the killing of apps themselves.[67][68] However, confusion over Android memory management has resulted in third-party task killers becoming popular on Google Play store; these third-party task killers are generally regarded as doing more harm than good.[69]

    I'd like this part to be bold, multi-colored, underlined and font size 500,000,000. I want every android user from now until the end of time to be able to see that section from space.


    Ask and ye shall receive.
    UJ95x likes this.
  6. #6  

    Default Re: [Guide] RAM and Android

    Wow awesome .

    Sent from my T-Mobile Note 3 using AC Forums.
    Golfdriver97 likes this.
  7. #7  
    UJ95x's Avatar
    Retired Ambassador

    Posts
    10,178 Posts
    Global Posts
    10,443 Global Posts
    Carrier
    Stock 6.0.1

    Default Re: [Guide] RAM and Android

    Excellent write up

    Sent from my Galaxy S4 running SOKP 4.4.2
    Aquila and Golfdriver97 like this.
  8. #8  

    Default Re: [Guide] RAM and Android

    Wow, this really helped me to understand. Thank you SO much!

    Posted via the Android Central App
  9. #9  

    Default Re: [Guide] RAM and Android

    Does this mean it would be better never to close all tabs? Or is that an entirely different thing?

    Posted via the Android Central App
  10. Thread Author  Thread Author    #10  
    Golfdriver97's Avatar

    Posts
    31,113 Posts
    Global Posts
    31,611 Global Posts
    Carrier
    Pure Nexus/Franco Kernel

    Default Re: [Guide] RAM and Android

    Quote Originally Posted by Dan Davis3 View Post
    Does this mean it would be better never to close all tabs? Or is that an entirely different thing?

    Posted via the Android Central App
    Welcome to the forums. If you mean the tabs in the recent apps menu, yes. Sometimes, when my device is getting loopy, I will close all apps, but more often than not, I will reboot the whole device.
  11. #11  

    Default Re: [Guide] RAM and Android

    Great information.

    Sent from my Nexus 6 using Tapatalk
    Golfdriver97 likes this.
  12. #12  

    Default Re: [Guide] RAM and Android

    Than you for great post. I have a question, I use greenify, is that considered a task killer too? I believe it is a very popular app, but after reading this post wondering why it is so popular...thanks again
  13. Thread Author  Thread Author    #13  
    Golfdriver97's Avatar

    Posts
    31,113 Posts
    Global Posts
    31,611 Global Posts
    Carrier
    Pure Nexus/Franco Kernel

    Default Re: [Guide] RAM and Android

    Quote Originally Posted by mwake4goten View Post
    Than you for great post. I have a question, I use greenify, is that considered a task killer too? I believe it is a very popular app, but after reading this post wondering why it is so popular...thanks again
    Good question. From its description, it flirts with some things that a task killer does, but it looks more like its user directed, as opposed to the app itself directing what gets killed and what doesn't.

    I think I will install it myself to see what it's like.
    Laura Knotek likes this.

Similar Threads

  1. VLC for Android, How to play videos on external SD card?
    By YouDunKnowMeh in forum General Help and How To
    Replies: 4
    Last Post: 02-05-2016, 03:36 AM
  2. S5 needs more RAM or less touch wiz
    By Zylograth in forum Samsung Galaxy S5
    Replies: 4
    Last Post: 04-15-2014, 09:58 PM
  3. Replies: 3
    Last Post: 04-15-2014, 01:31 PM
  4. Replies: 1
    Last Post: 04-15-2014, 11:26 AM
  5. Replies: 1
    Last Post: 04-15-2014, 02:37 AM

Posting Permissions