Few questions about RAM management on Android - General Questions and Answers

Hello. First of all, sorry if I got to the wrong forum section and not writing to general topic for questions. I wanted more details/opinions on these questions.
So I have a low-end android phone (Nokia 5) (hopefully topic is not phone specific) which only has 2 GB of RAM. When phone is just booted, it can store up to like 15 applications in the background (I actually managed to store 20 applications there at some point). It doesn't matter what apps are there (heavy or light (excluding Camera (later on that))) it manages up to 15 without closing them off. But after few hours (let's say like 20 hours) the amount of apps it can hold is reduced to like 5 (it varies). Like.. I can close all the apps and reopen them again, but as soon as 6th app is opened, first opened app is closed. Simply.. The idea is that I find myself reopening apps more and more often as the time since last boot increases. I understand that my phone is limited on RAM and it couldn't hold 15 applications in the background all the time, but why exactly is this happening? What gets stored so heavily in RAM as the time since last boot increases? Settings show that amount of memory used is 1.4 GB out of 2GB (which is why I never trust that number). I've tried force closing all the applications to see if that is some app-specific, but only rebooting device "fixes" it back to 15+ apps.
And second question is: can it be that the time (those 20 hours) is shorter on Oreo? I mean.. On android 7.1.1 I would restart the device like once per 2 or 3 days to get it back to the best performance. In other words.. Time since last boot would be longer before it reduces amount of apps that can be held in the background. But Oreo is using lot less RAM on it's own which makes it weird. And my device had some issues on RAM management between android 7.1.1 and Oreo that were 'fixed' so I was wondering if it's just Oreo 'function' or those issues never were fully fixed.
Also, I was wondering if Camera applications usually take much RAM (when not in background). My phone is holding like 10 apps and as soon as I open Camera/take a picture (either stock or 3rd party) ~5+ apps are closed.
I know that my english is far from perfect, but hopefully somebody will be able to understand this scribble

Benderisas said:
Hello. First of all, sorry if I got to the wrong forum section and not writing to general ....
Click to expand...
Click to collapse
Hi ,
The RAM management on Android is very smart in Android , since an app requires more RAM , Android will close himself some app state saved in the RAM ( what you called "App Running in background") so free up RAM and allocate it to the Game/Camera/Heavy RAM usage app.
15 app running in background is a proof of the power enclosed by the Android RAM management system.
When you reboot, the RAM memory is fully cleaned and the cache files (accumulated as you open and use apps) stored in it is cleared . That's why you can store more app running in background at the boot than after 20h.
So to answer your question , yes the camera app uses a lot of RAM , since it uses the kernel a lot and fully controls camera .
I don't know which is the best in RAM management between Nougat and Oreo but keeping at mind that Android improves most of the time at each update , I will advice you Oreo.
How this helped a bit
If anything I said above is incorrect or not complete , feel free to explain why it is and correct me :highfive:

That answered my third question about camera. First question was more of what is stored in RAM that it fills up. As far as computers go as I understand is that CPU cache has separate physical location away from RAM and unused files are stored in storage.
And second question is more about likeliness if Oreo could actually be worse even though it uses less RAM.

Benderisas said:
That answered my third question about camera. First question was more of what is stored in RAM that it fills up. As far as computers go as I understand is that CPU cache has separate physical ...
Click to expand...
Click to collapse
I don't think Oreo will be worst than Nougat , because most of the changes for this update was "behind the scene" , so I think it can be better.
For the RAM memory , she's filled by the data of the apps running in background , and when you use them , they store more and more data in it that's why at the end of the day your phone can be less powerful than at the boot up.
And I don't think CPU can store anything , it's doing task rather than store the memory , that's his role.

Related

[Q] What's Hoggin All The Memory?

Hello Guys and Gals,
After a couple of weeks running the factory update I find the mem available to twindle down as the hours go by.
I run task manager to free up mem after closing apps but after about 4-5 hours mem available is Regards to 185.
Any suggestions, hints or tips please?
Regards,
billygtab said:
Hello Guys and Gals,
After a couple of weeks running the factory update I find the mem available to twindle down as the hours go by.
I run task manager to free up mem after closing apps but after about 4-5 hours mem available is Regards to 185.
Any suggestions, hints or tips please?
Regards,
Click to expand...
Click to collapse
Stop using task manager. I have read that Froyo takes care of it by itself and using a task killer can actually make things worse. You shut something down that Android needs, it starts it up. You shut it down, something else wants it. Somehow that ends up using more battery and memory.
Other than that I don't know.
Tip: Stop thinking of the ram that Android uses the same way you think of ram in a PC. Period.
Why, Ever wonder why there is no 'exit' or 'close' button on most apps? It's b/c Apps don't close on Android, they just get moved down the stack so to speak. Think of it like a deck of cards. Some apps are thin (use little ram), some are thick (use lots of ram), the deck is only so big (total amount of ram). So if you have a bunch of small apps, then they will all be in memory. if you have a large app, it will push everything else out of ram to make room for it to run. So, if your ram usage is 100% then Android is working properly. This is why Task Killers are a bad idea on Android. The above is a pretty simple explanation and this topic has basically been beaten to death ever since Android was released. For some info, just google,
http://www.google.com/search?q=why+...s=org.mozilla:en-US:official&client=firefox-a
chad
Thank you both for your insight.
I will take your advice!
Thanks again... great forum!
Apologies, but based on my experience, I kind of disagree about ignoring RAM usage. I'd read some of that info awhile ago, and it made sense. But I noted that my Gtab would occasionally act weird, freezing, reboot, stuff like that.
So, I installed System Panel, and when things started grinding to a halt, I'd check that, and I often found avail memory in the 10-50MB range.
One thing was that Xscope would sometimes take almost 200MB, so I emailed the dev, who suggested changing cache from default 8 to 4. I did that, and then rarely found avail memory less than 150MB.
The other thing is I noticed that there a lot of Apps taking about 10MB, that I wasn't using. Things like Settings, Email, etc. So, I installed Startup Auditor, and configured that to stop several of those non-used apps. The thing I noticed after that is that booting is faster. Specifically, instead of sitting on the Tent boot screen for a long time, it would boot past that in maybe 10 secs. I'm thinking of buying the paid apparently so I can stop more than 5 Alps.
Anyway, YMMV, but that's my experience.
Jim

[Q] RAM observations

I have my Nexus S for over two weeks now, and I'm incredibly happy with it. Theming is a lot of fun, and you can do very cool stuff even without root and custom roms!
However, there is one (strange) thing I've noticed. It's about the RAM.
For your information: I use Go Launcher which has a tab in the App Drawer with running applications, and a button to close all (you can exclude certain apps). When I boot up my phone, I have 170-180 MB free RAM. The following programs (and widgets) are running in the background (I have excluded them from the close all list): Go SMS Pro (widget, notifications), WhatsApp (notifications), Lookout, Extended Controls (widget), Wiget Locker (I made it look like the MIUI lockscreen) and Clockr (widget).
There are two more apps that are on constantly, and those are the Miren Browser and PlayerPro. I don't know why Miren Browser keeps turning itself on. When I check how much MB it uses, it says 0,00 dB... As for PlayerPro, I use a widget called Phantom Music Control, a widget that hides itself when no music is being played. I also use it on my lockscreen. This widget controls PlayerPro, so that is probably why PlayerPro has to be running all the time (so that it can start up quickly when needed).
There are some Google apps that turn themselves on, like Gmail and Places, and they actually use RAM according to Go Launcher. I don't want them to be running, and synchronization is turned off with Gmail. When I want to know if I have mail, I open Gmail. It doesn't have to be running all the time. I've never used Places, and I never will use it, so I don't know why that has to be running all the time.
Every once in a while I hit Close All (with Go Launcher). However, I've noticed that over time my free memory keeps lowering. When I boot up my phone it is around 175 MB, but at the end of the day the free memory is 100 MB, 70 MB or even 50 MB, and yes, even after I've hit the 'Close All' button.
I know I don't use my phone very efficient, with programs like Go SMS, Widget Locker and that Music Control widget, and I will flash a custom rom later. My RAM memory will probably increase then (I've read something about Supercurio's kernel including a boost RAM management). It just bothers me that I don't have control over what programs are running (Gmail and Places), and that my free memory decreases over time. I haven't noticed any slow downs, I'm just worried. Or shouldn't I?
I don't know about the rest, but you shouldn't be concerned about free memory.
Android is designed in a way that all programs keep running (sleeping actually) in the background even when you don't use them at the moment. They are automatically killed when the system needs memory for something else. Any program that is sent to the background (e.g. by pressing back or home) can be killed by the system at any time and is (should be) ready for it.
Basically, the less free memory you have, the better. That means that many of the apps you use are running and you can return to them without delay.
There are some articles floating around the web about the architecture of android and process/application life cycle. They explain that better then me, and in more detail.
cgi said:
I don't know about the rest, but you shouldn't be concerned about free memory.
Android is designed in a way that all programs keep running (sleeping actually) in the background even when you don't use them at the moment. They are automatically killed when the system needs memory for something else. Any program that is sent to the background (e.g. by pressing back or home) can be killed by the system at any time and is (should be) ready for it.
Basically, the less free memory you have, the better. That means that many of the apps you use are running and you can return to them without delay.
There are some articles floating around the web about the architecture of android and process/application life cycle. They explain that better then me, and in more detail.
Click to expand...
Click to collapse
First of all, thanks!
So I don't have to be afraid of any slow down? And what about Gmail and Places turning themselves on every time, even if I don't use them?
And why does the free memory decrease over time, but increases again when I turn off and boot up my phone?
Androyed said:
So I don't have to be afraid of any slow down? And what about Gmail and Places turning themselves on every time, even if I don't use them?
Click to expand...
Click to collapse
More like the opposite: your RAM is being put to good use.
When your PC get's low on RAM it will start swapping and trashing around. Your smartphone has no swap and is optimized for it. If it get's low on RAM, it will just kill some stuff in the background. All this happens without you noticing anything (if the app is programmed correctly).
I don't know about Gmail and Places. Most likely they are running because they registered broadcast receivers or something.
Androyed said:
And why does the free memory decrease over time, but increases again when I turn off and boot up my phone?
Click to expand...
Click to collapse
Every app is running in its own dalvik virtual machine process. Since creating a new VM process is expensive (in terms of processing time), the VM processes are reused to some degree. One app is unloaded, the new one is loaded.
There is more stuff going on behind the scenes, of course. There are likely some spare VMs sleeping in the background waiting for an app to use them.
However, the heap (dynamically allocated memory of a process) of a VM can only grow and never shrink (don't ask me why). So after a few apps or so a VM process is restarted, too.
To come back to your question: When your device boots up, only the processes needed for boot are running. That will be the launcher, some widgets and so on. So basically, this is the moment with the most free RAM. However, this is also when your device is slowest, because every new app you launch has first to be loaded into memory and executed.
While you use your device, many of the apps you used will be kept around in the background, so when you start them again, they will reappear instantly, because the whole "create vm process --> load app from storage --> execute and initialize app" chain has already happened.
"Free memory is wasted memory."
When you open an app, the system loads it into ram. When you close it, the system should not bother to remove it from ram because there is a good chance you will use that app again and having it pre-loaded makes it open significantly faster.
Just because ram is "used" doesn't mean it can't be re-allocated for something more important.
That being said, it is entirely possible that some of your apps have memory leaks. Does it get worse after two days, or three days?
d-h said:
"Free memory is wasted memory."
When you open an app, the system loads it into ram. When you close it, the system should not bother to remove it from ram because there is a good chance you will use that app again and having it pre-loaded makes it open significantly faster.
Just because ram is "used" doesn't mean it can't be re-allocated for something more important.
That being said, it is entirely possible that some of your apps have memory leaks. Does it get worse after two days, or three days?
Click to expand...
Click to collapse
I turn my phone off every evening, so I don't know. It's not a problem by any means, I'm just curious.
I've left my RAM alone today, and I didn't noticed any slow down. It was on 110 MB free RAM when I left it alone, and when it was at 35 MB RAM, I decided to hit the close all button (there was no slow down btw). Guess what? My RAM went back up to 140 MB! Not as much as when I boot my phone up, but it's still strange: when I hit close all when the free RAM is very low, I get more free RAM then when I hit close all when my free RAM is around 100 MB (I only get 5 or 10 MB free RAM extra then).
Thanks by the way, good first post!

[Q] How to make Swap Partition For Galaxy Tab Plus

Hi
How can i create Swap Partition for increase RAM on Galaxy tab plus?
I find guide for other device, can`t find for Gt 6200
Thanks for help...
hmr007 said:
Hi
How can i create Swap Partition for increase RAM on Galaxy tab plus?
I find guide for other device, can`t find for Gt 6200
Thanks for help...
Click to expand...
Click to collapse
you can;t and should never need to.
You have 1 GB of RAM more than enough for any application.
Swap has not been used since Froyo I think . Since OG phones with 300 mb RAM.
Not used not needed
DigitalMD said:
you can;t and should never need to.
You have 1 GB of RAM more than enough for any application.
Swap has not been used since Froyo I think . Since OG phones with 300 mb RAM.
Not used not needed
Click to expand...
Click to collapse
Thanks for replay
but this 1GB (830 MB Actually) full after open 4-5 program or 2 game And Android close automatically other Application And last States!
I Want to save last States of other program Anyway until i Close program manually
For example Chrome close tabs after open 4-5 program and when i visit old tabs , it reloaded again!
hmr007 said:
Hi
How can i create Swap Partition for increase RAM on Galaxy tab plus?
I find guide for other device, can`t find for Gt 6200
Thanks for help...
Click to expand...
Click to collapse
Hi. Easiest way is to download Swapper2 from the PlayStore.
viper001 said:
Hi. Easiest way is to download Swapper2 from the PlayStore.
Click to expand...
Click to collapse
Only if you want to slow your tablet to a crawl.
Why would you want to swap very fast RAM with very slow SD memory? No need and a really bad idea.
DigitalMD said:
Only if you want to slow your tablet to a crawl.
Why would you want to swap very fast RAM with very slow SD memory? No need and a really bad idea.
Click to expand...
Click to collapse
agree. but, it looks like he's more concerned with multitasking.
it always depends on the user. let him try it first and let him decide what's acceptable for him.
Besides, "slow your tablet to a crawl" is an exaggeration.
viper001 said:
agree. but, it looks like he's more concerned with multitasking.
it always depends on the user. let him try it first and let him decide what's acceptable for him.
Besides, "slow your tablet to a crawl" is an exaggeration.
Click to expand...
Click to collapse
That won't help multitasking , Android already has an efficient memory management system. That OG swap app was for Froyo phones that only had about 300 mb to run the OS and apps. No longer applies. And since there are no true multi=tasking apps. IE you can;t run two foregrounds apps. ..... , you can never fill up RAM
DigitalMD said:
That won't help multitasking , Android already has an efficient memory management system. That OG swap app was for Froyo phones that only had about 300 mb to run the OS and apps. No longer applies. And since there are no true multi=tasking apps. IE you can;t run two foregrounds apps. ..... , you can never fill up RAM
Click to expand...
Click to collapse
OK. "Task-Switching" then .
Agree that android memory management is "efficient". the problem is that when it runs out of memory the app at the "back" of the stack gets "killed". data is saved for that app so when it's called back up, it "seems" like it was running all the while.
So, as per the OP question, since his problem was that his web pages keep reloading, ie app was killed due to memory constraints, his idea is to increase the RAM or in this case adding virtual RAM via swap.
It's not a bad Idea, since the amount of RAM is virtually increased, then the amount of apps that can be in RAM at the same time is also increased.
FYI, not only for froyo, i use swap for my NEO V running ICS. made DEAD SPACE run better than without swap. :good:
Haven't encountered a need on the P6200 though. Ofcourse, there must be a reason why 2GB RAM devices are now available.
there is not reason that swapping would make your tablet run better, none.
Because as of ICS , and with 1gb+ ram, you are emulating and interfering with what Android (linux) already does .
you have one foreground task and whatever idle tasks and then unused apps that are retained in RAM until they are needed or another apps needs space and they are removed from RAM. Then they reside on SD memory so what advantage does swapping to SD memory give you, none, in fact it adds a extra useless step .
SO Android attempts to keep RAM 80% used.at all times. If you look at the process logically, I do not believe can lay out a scenario by which the swapper apps beings any benefit to current Android systems.
DigitalMD said:
there is not reason that swapping would make your tablet run better, none.
Because as of ICS , and with 1gb+ ram, you are emulating and interfering with what Android (linux) already does .
you have one foreground task and whatever idle tasks and then unused apps that are retained in RAM until they are needed or another apps needs space and they are removed from RAM. Then they reside on SD memory so what advantage does swapping to SD memory give you, none, in fact it adds a extra useless step .
SO Android attempts to keep RAM 80% used.at all times. If you look at the process logically, I do not believe can lay out a scenario by which the swapper apps beings any benefit to current Android systems.
Click to expand...
Click to collapse
You actually pointed out the reason why the Original Poster wanted to use swap. he wanted his currently "unused" browser app to reside in ram, and not get killed. in this case it will be in virtual ram.
I agree with all your points. and I don't use swap on my tablet (P6200) haven't had a need, but i do use it on my phone(Neo V, 512 RAM, 384 useable).
All i'm saying is let him try. it's possible that he is hitting the limit on his Tablet. I know, cause it's easy to hit the limit on my phone that i'm very sure swapping works. e.g i can now switch between, Chrome, Facebook, Email, What'sUp, answer a phone call, send a text message and come back to Chrome (which has three open tabs BTW) without Chrome "reloading" those same three tabs. i wasn't able to do this before i starter using swap.
and yes, there's a bit lag but it's better than incurring cost of reloading a page each time, esp if your on a limited data plan.
One other thing that was not considered yet also are the OOM groups and Minfree. another option is Compcache.
The use of Swap really depends on the user and the way he uses his device. You can only see a benefit from swap if you consistently use up all your RAM. Which, if i understand the OP's problem correctly, is the case.

Crippled Multitasking in Stock 5.0.2 (XT1032)

Hey all,
After a frustrating month or two and a weekend of tinkering and troubleshooting I've lost patience and posted the below on the Moto support forums at https://forums.motorola.com/posts/c5fb348e02
So if you are experiencing similar issues please weigh in. If you have any ideas or a fix /workaround that doesn't involve rooting or custom Rom installation please let me know (I need access to my internet banking apps so root is a no no for the time being).
Hey Moto,
Why is the OOM/LMK with 5.0.2 so aggressive (XT1032) ? Multi-tasking wasn't great under KitKat but under Lollipop it's pretty much impossible. The most obvious and irritating symptom for me is music playback being killed within a few minutes (Play Music) if something like Chrome or Maps is open in the foreground. I used to be able to have navigation and music running in the car at the same time - no more.
So I've been on Lollipop for about 2 months now. The phone has been factory reset three times since and the last time I didn't use Google's Restore service post reset.
The observed symptoms are: The phone is quite happy whilst free memory is above about 250MB-300MB, nothing is killed and the phone maintains a healthy stash of cached apps. If free memory drops below about 250MB Android starts killing rather than caching and Developer Options/Process Stats reports the phone to be in a near permanent memory critical state. Why? There is still 1/3 of the installed RAM left - it shouldn't start killing background apps until sub 50MB is left surely?
I've uninstalled some of my less essential high priority user background apps (bye bye Muzei live wallpaper, by bye Dash Clock Widget) to make things bearable - it's memory critical about 20% of the time rather than 80% now - but it's ridiculous to have to limit oneself so much - 1Gb of memory should be sufficient to run a live wallpaper, a widget and one or 2 other relatively heavy background apps without crippling the device and it was sufficient under KitKat.
So can we expect a fix for this with 5.1 if it is coming our way? One potential clue - CyanoMod Developers have noted odd permissions, and if the permssions are fixed some crappy values in /sys/module/lowmemorykiller/parameters/minfree - the permissions make the files unreadable. CM12.1 reportedly patches this and cures the crappy multitasking.
I've checked on my unrooted stock device and sure enough these parameter files are unreadable (other parameters in various parts of system / sys etc can be opened as read only).
Click to expand...
Click to collapse

Probably problem with RAM usage

Disclaimer: Yes I know, empty RAM is useless and Android will free RAM for the active app by suspending apps that I "have not used for a while".
I have a problem that the current active app is closed by the system because it gets out of main memory - well in fact that is an assumption, I still need to track that down. Interestingly in contrast to Lineage 15.1. my Linage 14.1 has a memory section in the settings app...
1) memory settings shows me that the mobile has 1,7gb - its supposed to have 2gb. I'd assume that this is the kernel
or something like that, but the kernel is listed as part of the "Android OS", so where are the 300mb?
2) The settings app shows the average usage for at least the last 3h which is pretty pointless. If the app did not run 2h 55 mins of it, runs 5 mins and then crashes the average RAM consumption is obviously low. How do I found out wether lack of RAM is actually the issue?
(I have seen similar issues on two phones with 2gb RAM and no issues an mobiles with more than 2gb, which makes me think it is about the RAM)
3) What can I do to solve the issue if lack of RAM is the reason? (besides buying a phone with more RAM) are there hacks available that lower the memory footprint of the OS, the UI ....
thank you.
HelloItsMe222 said:
Disclaimer: Yes I know, empty RAM is useless and Android will free RAM for the active app by suspending apps that I "have not used for a while".
I have a problem that the current active app is closed by the system because it gets out of main memory - well in fact that is an assumption, I still need to track that down. Interestingly in contrast to Lineage 15.1. my Linage 14.1 has a memory section in the settings app...
1) memory settings shows me that the mobile has 1,7gb - its supposed to have 2gb. I'd assume that this is the kernel
or something like that, but the kernel is listed as part of the "Android OS", so where are the 300mb?
2) The settings app shows the average usage for at least the last 3h which is pretty pointless. If the app did not run 2h 55 mins of it, runs 5 mins and then crashes the average RAM consumption is obviously low. How do I found out wether lack of RAM is actually the issue?
(I have seen similar issues on two phones with 2gb RAM and no issues an mobiles with more than 2gb, which makes me think it is about the RAM)
3) What can I do to solve the issue if lack of RAM is the reason? (besides buying a phone with more RAM) are there hacks available that lower the memory footprint of the OS, the UI ....
thank you.
Click to expand...
Click to collapse
If it's a RAM issue, you can try setting up the ZRAM mod on your device or you can try creating a "swap partition" similar to the swap partition used in Linux. ZRAM and swap partition are different from each other but they both basically convert a portion of your internal storage into a type of "virtual RAM", this might help give you more space to be used as RAM to keep your app/apps from crashing. It requires a rooted device though.
Take a look at this:
https://forum.xda-developers.com/showthread.php?t=2217202
Sent from my LGL84VL using Tapatalk
Thank you for idea & link - however, the latest version is almost 6 years old and download links are dead (dropbox 404), so that might be a dead end....
HelloItsMe222 said:
Thank you for idea & link - however, the latest version is almost 6 years old and download links are dead (dropbox 404), so that might be a dead end....
Click to expand...
Click to collapse
I didn't give you the link to use what was in the link, it was to give you a reference to understand what I was describing, then take that information and do some research to learn how to go about doing it using valid software from today.
Now, you just need to do the research to see the currently available options that offer the same capabilities and how to set it up. Why does everyone act like it is too much work to do some reading and learning for themselves, no one wants to think anymore, they just want a simple answer handed to them that requires no work. If you aren't willing to put some effort into learning something, then you just need to stop trying to change things about your device and just use it as it is.
Sent from my LGL84VL using Tapatalk

Categories

Resources