In 1981, Bill Gates allegedly stated, “640 k ought to be enough for anybody.” He was referring to kilobyte of memory or RAM in personal computers back then. Today, we talk about investing in a smart-phone with 6 or 8 GBs of RAM for optimal performance. One of my current work laptop that I occasionally use for work has a decent 4GB of RAM installed, I never felt the need for more RAM ever.
How did we end up with smartphones in stores with whooping 10 or 12GB of RAM? Is there a need for more than 4GB of RAM on your smartphone unlike Pixel 3 unless used for the unintended purpose? Well, we need to learn how Android RAM Management works in order to arrive to a conclusion.
Android RAM Management
Depending on OEM and their Android ROM maintainers, your phone’s RAM may or may not be reserving some part of the RAM for swapping in and out. It is a scheme of Android RAM Management system to free Available RAM required by the new app that you have just open. What is swapping? Swapping is a process of compressing the memory and writing it back to memory, in the above said reserved space of physical memory in order to increase available RAM for more apps. Now let us say if the set compression level saves 40% of memory, the saved memory can be used for other apps. The process of writing compressed memory to the reserved memory for swapping is called swapping-out. Since the compressed memory is not readable hence it has to be decompressed and written back to memory, this is called swapping-in. The reserved space or portion of RAM for swapping in and out is managed by a Linux kernel module called Zram.
Also, there is no uniform formula that decides the zRAM levels as seen in different devices of different vendors or OEMs. Samsung Note 9 allots 2G in the 6G variant as total SWAP. Whereas Huawei Mate 8 uses 0.5G of RAM as SWAP in the 3GB variant. So, the views of Android engineers working in different OEMs varies on what amount of Available memory should be there on a fresh boot for a consumer on their device. What is interesting to note on Samsung Note 9 is that over 250MB of SWAP is already used post reboot. It is significant to not overburden RAM with more SWAP as swapping was designed to free more available memory in the first place. Some radical vendor claiming to be flagship killers like OnePlus do not use SWAP or zRAM on their 8GB variant, which is acceptable.
Swapping with zRAM is going to be frequent on devices with 3 to 4GB of RAM when you start to use or load more resource heavy apps like Google Photos or a lot of games and switch between them. As read above swapping is sometimes used right from a fresh reboot. What happens when both the zRAM and available memory runs out completely? It is eventually going to happen as you load more apps without removing them or swiping them from recent apps list. This is where the role of Android OS’s aggressive RAM management tool comes in picture, earlier it was managed directly by Linux kernel using a driver called ‘Low Memory Killer driver’. It would select apps using a complex yet understandable equation.
With the release of Linux kernel 4.12, the driver was removed and now the job is managed by userspace called ‘Android Low Memory Killer Daemon’ or lmkd. It basically monitors and kills a least relevant process or your app while upholding system performance. Most of the time this killing is so seamless that you won’t even notice. Imagine an application that you did not even use for days that got killed to pave way for the new app you wish to load and use. You probably forgot the process or app that is killed only. Not like Android is ruthless and will kill just about any data critical app running in background without any warning to save data.
It still does not explain the need for more than 4GB of physical memory on the device. In order to simply we must know the amount of memory used by most used apps.
Info-gram published by Android Authority in early 2019 as seen below makes it obvious that most users including the ones who are fairly active on social media apps should be fine with Huawei Mate 8’s 3GB RAM variant.
It is only when you do hardcore gaming along with heavy web browsing or multiple social media apps or other resource intensive tasks simultaneously, than you need more RAM. Even then your smart-phone won’t need more than 6GB of RAM. You do the math to understand how much RAM you actually need even on an Android phone. Having known this makes the complex equation of Google picking 4GB of RAM for their flagship device like Pixel 3 simple. It was a device to offer the most clean, vanilla, state-of-the-art Android experience to its users. It was never meant for hardcore gaming eitherways. Pixel is for smart-phone camera buffs who love to flaunt nifty camera skills on their favorite social media apps. Google did not advertise it as fastest or a beast for gaming or other purposes.
If you ask me, with growing demand of resources for optimal web browsing needs, it is suggested to go with 6 GB variant of whatever device that you pick. Other than that, 4GB is still fine to run multiple apps including social media, audio/video streaming, basic web browsing, email, fun games, navigation etc. With proper optimization and reserved swapping space from physical memory, everything could still be memory and zRAM without having to let ‘lmkd’ be violent. If you are considering an Android phone today, go with a minimum of 4 or 6GB of RAM depending on your use case. 8GB of RAM should only be taken into consideration if you are buying a device for extensive gaming, browsing or some serious RAM intensive tasks on a smart-phone, which you should be doing on a laptop or a desktop anyways. But if you are comfortable enough on an hand-held device, so be it. You can also consider 8GB of RAM if you do not like the idea of swapping. You could load a great number of apps and keep them in memory for as long as you like without having to SWAP.
A common myth among users is to buy variants with more RAM with expectation of extra performance. Sadly, Android’s documentation on App’s memory talks about using as less memory as possible and optimization of code to use less memory. You cannot expect a developer to make use of your extra RAM owing to guidelines set by Google itself. Unless a standard minimum RAM is acceptable your extra gigabytes of RAM is not going to give you an extra punch or boost whatsoever. I believe, while using your smart-phone for the intended purposes it cannot fully use 8GB of RAM ever. You should stop shelling out more money for more RAM. There is a myth regarding more battery power consumption owing to more RAM on device, but it is not very rational as per me. Technically, yes, more RAM is going to consume more power but not enough to reflect in daily usages and there a reason for that. Because you could practically avoid SWAP space with 8GB of RAM saving a lot of CPU power during swapping in-and-out.
Conclusion
It is not unfair to conclude depending on the workload 8GB of RAM might not take more power when compared. For me, I would not buy an Android smart-phone with more than 4 or 6 gigs of RAM even in 2020 given my use case. If you pick 8GB, I have absolutely nothing against you but do not buy it for extra performance versus 6GB variant of the same device. I would be seriously unhappy if you go with 10, 12 GB of RAM for a smart-phone today. You are being Mr Cool or specs freak, trying to glamorize or making it look cool to have the best specs for no reason at all. Honestly, I had 4 GB phones for the last 5 years and I can’t imagine why would I need more. Especially these days, Android has very powerful optimizations regarding memory caching and out of memory (OOM) management, so RAM is never a problem.
Wait.. What about iPhones?
Memory management on iOS is interesting. Although it also uses a similar scheme like Android’s lmkd to kill apps. It does things differently in handling an App’s resident set size or RSS. According to Gary Sims, host of Gary Explains, a well known Youtube channel, iOS reduces or compresses the size of memory used by an app in the background when you switch from it to another app to so startling low. As per Gary Sims, an app that took over 300MB of memory on first load, goes to lower than 10MB of memory when in background. This level of compression of apps while still keeping the data intact to instantly load the app in foreground when a user switch back to it while actually reducing the memory uses to less than what it originally was (~100-200MB) on first load is the secret magic making an iPhone win the race with much less RAM more efficiently than Android.
But all is not well, as per many developers memory management on iOS is too aggressive and frustrating. Albeit, no one is talking about it owing to fear of being ridiculed by the tech giant. As per many unnamed developers that I personally talked to, Apple puts low RAM in iPhone to artificially bottleneck the device. Every single iOS release has been according to RAM count (apart from the move to 64bit iOS, which naturally only works on 64-bit CPUs). Less RAM is not fine, it actually a major problem on iOS devices right now, but no one is talking about it for above said reasons.
One developer said, Split view cannot function on iOS owing to aggressive RAM management. iOS is highly aggressive. It flushes apps from RAM at an insane rate, if it exists foreground. Sometimes as short as less than 5 seconds.
According to another developer, low RAM on iOS is simply not fine at all. A webpage on Android/windowsmobile/iOS will use similar amounts of RAM. Web apps are getting heavier, etc. So, an Android smart-phone with 8GB RAM is gonna be able to deal with browser tabs a lot better than some iPhone with 4GB of RAM. There is no magical way around that. And that’s just the browser app. iPhone 11 has such good CPU that it demolishes anything and everything. However iOS is total junk in that you can exit an app for 5 seconds and there is a good chance it will be flushed from RAM, causing app reload, and losing all progress you did. This is not a good experience from memory, if you are a developer, you have only a couple seconds in background before your app is relegated to super low priority, even if there is further ‘available’ RAM. This just cannot be pleasant from the point of view of an end-user either.
One truly frustrated developer, went on to talk about similar issues with recent iPads and how they are artificially limited in RAM count. He said, on an iPad Pro, trying to do pro level work or even ordering a Pizza. There is a good chance by the time you swap back to your online ordering form, it gets flushed from RAM, reloaded and now your information is gone.
After talking to a couple of Apple developers, I can say in Android, if the app wants RAM, it gets the RAM. If it’s not in foreground, it’s given lower priority, but it keeps the RAM. If something else opens up and needs more RAM than is available, Android will kill some background app via some ranking system. In iOS, it just kills the app regardless of the above said magic in RSS of foreground apps. The CPU is revered by developers, at the same time lack of RAM stifles its true potential and is a major cause of worries.