OK, Phil and Jerry, then explain this to me . . .

Vance14

Well-known member
Aug 17, 2010
727
47
0
Visit site
Phil and Jerry keep saying that low RAM has no effect on performance, that if you have RAM not being used, it is "wasted" RAM in any case. And, as a general principle, I agree and never bother with trying to manage my RAM, never use a "task killer", etc. In short, I do not obsess over my RAM or memory management. I don't even think about it unless there is a problem.

BUT, this issue keeps coming back. Every once in a while my Nexus will really slow down, it will get choppy, a lot of redraws, some apps will even crash or time out. Whenever this happens I will go check my RAM and find that it is very low. And, until I kill off a few things (or reboot, which does the same thing), the performance will stay bad. Once I kill off some stuff, and regain some free RAM, everything is fine and back to normal.

It seems clear to me that if you have low RAM, and then you engage in some heavy-duty activity, you will actually hit the wall, run out of RAM and your performance will be hit. I know that the OS itself is supposed to automatically start killing off stuff to keep enough RAM to keep this from happening, but obviously it doesn't always get it right.

Now, this problem was DRAMATICALLY worse with my RAM-challenged OG Droid, and it happened less often with my Thunderbolt, and even less often with my Nexus. Each step up has generally had more free RAM available as a buffer to handle heavy use, and my theory is that this extra free RAM is a Good Thing, not a waste, since Android doesn't always handle it right. The more free RAM, the less you have to rely on Android to get it right, and the less often you will have problems.

So, why is my theory wrong? Why is it NOT better to have that extra RAM to avoid these problems? If the extra RAM is not useful, why is the performance of my phones better with more extra RAM and worse with less?
 

thebignewt

Well-known member
May 11, 2010
395
12
0
Visit site
I think that because our phones now have way more RAM than older phones, the issue just comes up less. The Android OS is supposed to not allow the phone's RAM to fall below the threshold for good operation. If yours still does then your circumstances may be unusual. My phones never slowed down, nor have I ever used a so-called "task killer". I used to battery pull my Blackberries and watch the "free memory" stats go up and down, but my wife never pulled the battery on her Curve and it was fine.
 

anon(596177)

Well-known member
Dec 14, 2011
1,189
105
0
Visit site
This is only true if you dont have 1000 apps running and updating at the same time. Yeah, Android has that nifty RAM saver feature built in, but it will only clear programs from ram that were maybe opened but no longer being used. This is why many people say that this phone doesnt actually "Multitask" well, because it closes apps you have opened after a certain amount of inactivity and with the GNex (or ics) that amount of time before it kills an inactive app is relatively short.

If you open a few apps that stream music, video, or maybe u are transferring files to the cloud, running remote desktop, emails with push notifications, IM clients with push notifications... all of these things will slow down your phone if opened together because Android will not clean them from RAM because they are technically being "used". Antivirus apps and battery saver apps are huge culprits of this too as they are ALWAYS running and some can eat a lot of RAM to do so.

Now Im not saying that you run many apps like this all at once on your phone because I dont know your situation, but from my own experiences and from witnessing some of my friends' random android slowness, this is the best conclusion I can come up with.
 

Vance14

Well-known member
Aug 17, 2010
727
47
0
Visit site
I agree with that entirely, which is why I think having the extra ram is useful to avoid problems in those situations.

Sent from my Galaxy Nexus using Tapatalk 2
 

turdbogls

Well-known member
Feb 4, 2011
377
31
0
Visit site
i dont think anyone said more RAM is a bad thing. obviously we would all LOVE to have 2gb ram.
when they say unused RAM is wasted RAM they are referring to task killers. having 1gb ram but only using 250 MB through the day is wasting RAM simply because the phone can handle more than that, and killing off tasks to have tons of RAM is just a waste.

but yes, i notice the slowdowns, not NEARLY as much as my OG droid, Droid X, or my thunderbolt, but it does happen...but usually if i just let it sit for a few seconds it speeds back up.

still confused why these lowdowns happen when there is still 100mb of RAM left. obviously i just dont know how that all works, but still.:p
 

Mooem

Well-known member
Feb 18, 2011
1,080
84
0
Visit site
I always thought their beef was with third party "auto task killers" and this misconception that less apps in RAM = better battery life, not so much in terms of just performance (of which will vary since, you know, my experience is not your experience necessarily). Essentially, your device is using the same amount of energy to keep things in memory as it does to power it unused.

Performance degradation WILL happen if Android is not properly handling memory efficiently, however. This is especially prevalent with badly coded apps, in which case it may not necessarily be a core Android issue but with specific apps. In other cases, as Poseign indicated, if someone is forcing Android to run numerous services and apps at the same time, it will most definitely struggle to keep things running smoothly.
 

pool_shark

Well-known member
Aug 21, 2010
1,779
75
0
Visit site
I disagree that anti-virus apps are resource hogs. They only run when you download an app, tell it to run a scan, or it runs a scheduled scan. Other than they they are sitting idle (using memory but not CPU) just like every other app.
Proof of this can be seen by having your AV app running, go to the command line and run the top command. You will see the AV app at the bottom of the list with regard to CPU usage.
 

Vance14

Well-known member
Aug 17, 2010
727
47
0
Visit site
I agree that RAM that is not being used is, by definition, "wasted" at that particular moment. But, without enough of that extra RAM, it is very possible to simply "run out" when you get very task intensive and Android doesn't manage it well.

What I have found is that when I have 150 mb or less of free RAM, I am very likely to run into actual performance issues at some point. If I have more than 200 mb free, I never have such problems. So, that extra free RAM I have over 100 mb or so is not wasted at all, but is essential to good performance since it will be there when I need it.

This came up as an issue in the last podcast when someone wrote in about not having enough free RAM and being uptight about it. Again, I never sit around worried about how much RAM I have . . . until I have a problem. And when I do have a problem, running out of RAM is almost always the cause, and freeing up some RAM is almost always the solution.
 

KoukiFC3S

Well-known member
Oct 9, 2009
1,724
123
0
Visit site
I see that some custom roms let you change the minimum ram free amount.

I guess stock is 79MB. Has anyone messed with this and see any improvements?
 

thebignewt

Well-known member
May 11, 2010
395
12
0
Visit site
Honestly, they still try and sell you those "battery saver" apps? I thought those died with the cassette. Antivirus scanners, really? Man that's hard up stuff right there.
 

Vance14

Well-known member
Aug 17, 2010
727
47
0
Visit site
The reason this is an issue is that I HATE redraws with a passion. Coming from the OG Droid, I have developed an irrational abhorrence to a blank homescreen waiting to be repopulated. When this happens, I know that the Android OS has somehow failed me, and not killed off enough other processes to keep my icons locked and loaded. And, possibly this is because it DID kill off all the processes that it could, and there STILL was not enough free RAM to keep the homescreens intact. In either case, a ton of free RAM would have solved that problem and there would be no redraws.
 

thebignewt

Well-known member
May 11, 2010
395
12
0
Visit site
Seems to me this is (like many other phone "issues") operator dependant, not a phone problem. You may need to bone up on stuff to fix it instead of hoping that the phone would fix it.
 

Vance14

Well-known member
Aug 17, 2010
727
47
0
Visit site
Seems to me this is (like many other phone "issues") operator dependant, not a phone problem. You may need to bone up on stuff to fix it instead of hoping that the phone would fix it.

No, this post is not about "how do I fix this problem", but simply discussing whether or not having free RAM is important in the smooth operation of the phone. When I run into problems, I know what to do about it.
 

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,797
113
Visit site
RAM is used in many different ways. You see a slowdown when too many things are trying to stay in the foreground. Foreground apps will try to close background processes and sleeping tasks (basically anything that's not a required service) if they need more memory.

If I write an app like Instagram --

I can code the processes and threads in different ways with different priorities. The correct way would be to have the threads and processes needed to run the app in the foreground while the user has it open and looking, and when the user no longer has my app on the screen a main thread goes to sleep, a thread runs as a service to accept push notifications or check for updates, and the rest of the threads are "ghosted" -- marked as dead, not running, and OK to kill when more space is needed. The service (that checks for updates or push messages) would be very small and only used to wake up other processes when updates are received, the main app would be asleep (ok to close if it has to be closed), and the other misc threads are dead, and ready to be killed. There's no need to flush them unless they are needed, because there's a chance the next app that gets opened is my app.

Now if I did it the wrong way, my misc threads and routines would just get backgrounded, and the system will think they should stay alive if at all possible. Or I could bundle everything up in the service that runs always. Or if I really wanted to foul things up, I could code the main app to stay awake even if not displayed to the user. Don't laugh -- apps like that are out there.

TouchWiz 4 is a great real-world example. Prior versions of TW were pretty roughly coded in relation to proper memory management. But when TW 4 came out on the SGSII, people were amazed at how well it worked. Word is HTC has done the same thing with Sense 4. As developers get better at coding for Android (both big guns like Samsung and HTC, and small independent devs) apps will get better and better at managing their memory space.

For now, the only way to fix the issue is to root and edit the minfree settings, or go a step further and edit the kernel minfree settings before building , or just not use apps that cause your phone to crawl. Flushing the RAM is just a temporary fix, because the next time you use an app that behaves poorly it's going to do the same thing again.

One last thing to consider -- next time things get slow, check the CPU speed. Many (as in many, many) times we blame RAM when the CPU is pegged and the system is CPU bound. An that's a whole other mess.
 

Phil Nickinson

Android Central Editor Emeritus
Apr 21, 2009
4,508
3,181
0
Visit site
RAM is used in many different ways. You see a slowdown when too many things are trying to stay in the foreground. Foreground apps will try to close background processes and sleeping tasks (basically anything that's not a required service) if they need more memory.

If I write an app like Instagram --

I can code the processes and threads in different ways with different priorities. The correct way would be to have the threads and processes needed to run the app in the foreground while the user has it open and looking, and when the user no longer has my app on the screen a main thread goes to sleep, a thread runs as a service to accept push notifications or check for updates, and the rest of the threads are "ghosted" -- marked as dead, not running, and OK to kill when more space is needed. The service (that checks for updates or push messages) would be very small and only used to wake up other processes when updates are received, the main app would be asleep (ok to close if it has to be closed), and the other misc threads are dead, and ready to be killed. There's no need to flush them unless they are needed, because there's a chance the next app that gets opened is my app.

Now if I did it the wrong way, my misc threads and routines would just get backgrounded, and the system will think they should stay alive if at all possible. Or I could bundle everything up in the service that runs always. Or if I really wanted to foul things up, I could code the main app to stay awake even if not displayed to the user. Don't laugh -- apps like that are out there.

TouchWiz 4 is a great real-world example. Prior versions of TW were pretty roughly coded in relation to proper memory management. But when TW 4 came out on the SGSII, people were amazed at how well it worked. Word is HTC has done the same thing with Sense 4. As developers get better at coding for Android (both big guns like Samsung and HTC, and small independent devs) apps will get better and better at managing their memory space.

For now, the only way to fix the issue is to root and edit the minfree settings, or go a step further and edit the kernel minfree settings before building , or just not use apps that cause your phone to crawl. Flushing the RAM is just a temporary fix, because the next time you use an app that behaves poorly it's going to do the same thing again.

One last thing to consider -- next time things get slow, check the CPU speed. Many (as in many, many) times we blame RAM when the CPU is pegged and the system is CPU bound. An that's a whole other mess.

What he said ...
 

Vance14

Well-known member
Aug 17, 2010
727
47
0
Visit site
Phil, I knew you we're going to say that. :)

Jerry, that is awesome information, it explains a lot (assuming I understand it all!). But, setting aside the cpu issue for the moment, would I be correct in saying that if we DID have a massive amount of RAM (hypothetically unlimited for discussion purposes) this would compensate for these design and development issues and keep the phone from ever running out of RAM and the problems that come with that?

Sent from my Galaxy Nexus using Tapatalk 2
 

sniffs

Well-known member
Dec 3, 2009
1,792
83
0
Visit site
When my phone runs low on memory, and I click the Home button, I notice my launcher has been exited and all my widgets have to reopen.. this happens when my ram gets below about 100MB..

That's the most annoying thing about running low on ram, launcher/widgets restart.
 

Vance14

Well-known member
Aug 17, 2010
727
47
0
Visit site
Sniffs, that is my experience as well. This never, ever happens when I have more than 200mb of free memory.

When I was on the OG Droid, this was so bad, the rooted phones had a special code you could put in to lock your homescreens in memory so that they are the last thing (or nearly the last thing) that gets dumped overboard as memory gets low. I don't think this is needed in the Nexus because it is only an occasional problem, but I really did think those days were gone with so much existing RAM on the phones. But, as they added more RAM, I just added more apps that run in the background!! :0)
 

sniffs

Well-known member
Dec 3, 2009
1,792
83
0
Visit site
Sniffs, that is my experience as well. This never, ever happens when I have more than 200mb of free memory.

When I was on the OG Droid, this was so bad, the rooted phones had a special code you could put in to lock your homescreens in memory so that they are the last thing (or nearly the last thing) that gets dumped overboard as memory gets low. I don't think this is needed in the Nexus because it is only an occasional problem, but I really did think those days were gone with so much existing RAM on the phones. But, as they added more RAM, I just added more apps that run in the background!! :0)

Never heard of a code, but the 3rd party launchers had the ability to lock in memory prior to GB 2.3, now it seems the feature is useless?

Between all the apps I use and Webtop(I use it daily with my lapdock), I'm usually hovering around 360MB of ram