Across all consumer electronic markets, spec battles are inevitable. Company A releases product X with 24 thing-a-ma-jigs, so in response Company B releases product Y with 32 thing-a-ma-jigs. Company A responds to Company’s B bump in the specs and a spec war starts.
The problem is when spec wars get out of hand. Company A started by using 24 thing-a-ma-jigs, but three years later it’s shipping with 48 thing-a-ma-jigs, a massive and likely unnecessary increase. Android smartphone makers aren’t immune to this. We have seen bumps in processor performance, camera capabilities, internal storage, and much more. Most of these spec bumps are needed and well received by consumers. However, I think in one area the spec war has become ridiculous: RAM.
Back in the early days of Android smartphones, devices had 512MB of memory or maybe even 1GB. These were the humble beginnings of the smartphone revolution. Over time more memory was added. By 2014, most high-end devices had 3GB of RAM and during 2016 and 2017 4GB became the de facto standard. Then the spec wars started. First came devices with 6GB, then 8GB, then 10GB, then 12GB — where will it end?
With RAM seemingly increasing every quarter, we must stop and pause and ask ourselves how much RAM we actually need. I have laptops here in my house that are running Windows 10 quite happily with 4GB of RAM. My MacBook has 8GB of RAM and can run demanding applications like Premiere Pro or Photoshop. Are we seriously suggesting my phone needs more RAM than my laptop?
At this point, you might be already saying to yourself, “I know how much RAM a smartphone needs, it is X Gigabytes.” You might be right, but you probably aren’t. Putting subjectivity and opinion to one side, what we need is an objective look at how much RAM is needed.
First, a look at how Android manages RAM.
When you launch a new app on Android the Linux kernel creates a new process. A process is a unit of execution with its own virtual address space (which is mapped to physical memory). The Linux kernel manages the resources needed by the process including time running on the CPU, input and output of data (over the network or via the filesystem), and physical memory (RAM).
When there is an abundance of resources the kernel’s job is easy. If the process needs more CPU time and the CPU is idle, the kernel can easily grant the process more execution time. If there is little I/O, giving the process more I/O isn’t a problem. If the process needs more RAM and RAM is available, the kernel just needs to track what process is using which bits of memory.
However, when resources are scarce things become complicated. With CPU time and I/O, the biggest casualty of overloading is performance. If the CPU is busy, the work at hand will still get done, but it won’t be as quick. RAM is different. When you have no more, waiting longer probably won’t result in any more RAM being freed. This is where the kernel needs to be proactive to get back some RAM.
Linux and Android handle this in two ways. First, there is the idea of swapping using zRAM. Android can allocate a chunk of physical memory for swapping. Swapping is an idea Linux uses on PCs and servers. When there isn’t enough memory, the oldest and least used pages of memory are written out to the disk and the memory they occupied becomes available for other processes. If that swapped-out memory is needed later, the saved data is read back from the disk and put back into memory (swapped-in), where it can be used.
Android compresses the memory and writes it back into memory, but into the section reserved for zRAM. If we assume a 50 percent compression ratio, 128KB of RAM can reduce to 64KB, freeing up 64KB. This is the equivalent to swapping-out pages to disk. The compressed memory isn’t directly readable, so if it is needed it must be uncompressed and written back. This is the same as swapping-in.
When a process requests more RAM and RAM is unavailable, the kernel will try to free up some RAM using swapping. If sufficient RAM can’t be found, the kernel needs to get more aggressive and start culling processes. This is a strange situation for the kernel. It must kill an existing process, to make room for another process. The key here is the current memory request is likely coming from the foreground app, which is currently in use. The kernel applies various tests and checks and determines which processes can be killed off to free memory. If you started Candy Crush three days ago and switched away, but never returned, then the kernel can assume you aren’t going to switch back to it now and so kills it off. This frees memory and allows the currently running app to continue.
This is all handled by the kernel’s Low Memory Killer driver. Interestingly, future versions of Android will handle this slightly differently. While the result will be the same, it won’t be the kernel’s assassin that does the dirty deed. Starting with Linux Kernel 4.12, the Low Memory Killer driver has been removed and instead, the userspace Android Low Memory Killer Daemon (lmkd) performs the cullings.
This means when you start a new app, older memory resident apps, are removed to make way. If you switch back to these apps, using the recent apps screen, then the apps will be reloaded, similar to an initial launch.
Although this system may sound brutal, it is the way Android was designed. All apps are given ample warning that they will be killed off and move through different states allowing them to save their current status information. When they are reloaded, the apps just read the last status information and carry on from where they left off.
How much memory do apps use?
Starting with Linux Kernel 4.12, the Low Memory Killer driver has been removed and instead, the userspace Android Low Memory Killer Daemon (lmkd) performs the cullings.
If the low memory killer activates too frequently, the overall user experience can be affected. In a worst-case scenario every time you switch away from an app to start another one, the previous app will get killed to make way for the new app. This is a severe low memory condition. However, there is an acceptable sweet spot where the occasional resident app is removed to make way for new apps. As long as the removed app is “old,” the user probably won’t even notice it was removed from memory. After that sweet spot the frequency of app removals becomes academic, since there won’t be much perceptible change in the overall user experience.
However, what is the sweet spot? To find that out I wrote a utility which uses the Android Debug Bridge (adb) to monitor which processes are being killed, along with the amount of available memory. It also looks at how much RAM the running apps use.
After lots of experimentation, I have come up with a list of three different categories of apps. “Standard” apps use between 130MB and 400MB of RAM. There are apps like YouTube and WhatsApp, as well as games like Crossy Road and Candy Crush. Then there are the “media-intensive” apps, which load lots of images and therefore use more memory to show them. Here you will find titles like Google Photos and Instagram. These apps use between 400MB and 700MB of RAM.
Finally, there are the “huge” apps, predominantly high-end games which can eat through RAM like a hungry Pac-Man. Games like Need for Speed: No Limits or PUBG Mobile can use between 800MB and 1152MB. Chrome is also in this category (with 3 tabs open).
The amount of RAM being used on your device depends entirely on which apps you have running. If you like Instagram and Candy Crush, but not much else, then you will be using just over 1GB of RAM. If you switch between PUBG and Asphalt 9 all day long, you’ll need 2GB, and so on.
How much RAM do I have?
Each Android smartphone comes with a fixed amount of RAM. It is part of the phone’s motherboard and it isn’t upgradable. The Pixel 3 has 4GB, the Note 9 (128GB) has 6GB and the OnePlus 6T has 8GB. The OnePlus 6T McLaren edition has 10GB and the Lenovo Z5 Pro GT has 12GB. While it’s important to know how much RAM your phone has, it is also important to know how available it is for running apps. Android and Linux will both use some RAM, and as do some pre-installed user level services. Here is a table of some devices I had at hand, showing the installed RAM and the available memory. Available memory is how much memory is available for starting new apps, without swapping.
|Device||Total RAM||Available Mem||Total SWAP||Swap Used (after reboot)|
|Huawei Mate 8||2881||1392||511||0|
|Pixel 3 XL||3548||1740||1023||8|
|Samsung Galaxy Note 8||5339||2799||2559||34|
|Samsung Galaxy Note 9||5580||3597||2048||266|
The Mate 8, Pixel 3 XL, and Note 8 make about 50 percent of the installed RAM available for user apps. That number starts to climb slightly with the Note 9 and the OP6T, with the latter offering 66 percent of the installed RAM to the user.
It is also interesting to note the wide range of zRAM levels OEMs choose. The Mate 8 uses 0.5GB of swap, while the Note 8 is configured to use 2.5GB! Interestingly, OnePlus is so confident in the 8GB found in the OP6T that it doesn’t use any swap space.
A device like the Pixel 3 XL can hold at least five “standard” apps in memory without swapping. This means you can switch between YouTube, WhatsApp, Spotify, Candy Crush, and Google Play without concern. If you start more apps then the Pixel 3 XL will start to use the compressed swap space more aggressively in an attempt to free up memory. This means in reality, you can run around eight “standard” apps and keep them all in memory and the swap space. Switching to an app that’s swapped out will swap it in. Swapping isn’t really noticeable. Often background process get put into the swap space first. If you start more than about eight “standard” apps, one of the previous apps will be removed from memory.
If an app is pushed from memory, that isn’t necessarily bad — the app will reload on switch. However, there is an argument to be made that devices as expensive as the Pixel 3 should include more memory.
The Note 8 and Note 9 have 6GB of RAM, with about 2.5GB available to the user on the Note 8 and 3.5GB on the Note 9. Both devices have at least 2GB of swap space, too. This means you can switch between a heavy game (or Chrome), a media-intensive app (like Instagram) and 5 or more standard apps and everything will remain in memory. If you start more apps, the phone will start using the swap space. This boosts the number of memory resident apps even higher.
6GB is the beginning of the sweet spot. Common apps remain in memory for long periods of time and the multi-tasking experience is seamless, most of the time.
These 6GB phones can switch between a dozen or more apps, including some heavy duty ones, without seeing a single reload. This is the beginning of the sweet spot. Common apps remain in memory for long periods of time and the multi-tasking experience is seamless, most of the time.
The sweet spot continues into the 8GB realm. Here you can keep at least a dozen apps in memory without reloading, including bigger apps like PUBG and Google Photo. Switching between apps is seamless. Over time, older apps will be removed from memory to make way for new apps. You probably won’t have touched the apps that get removed for days when that happens. Having said that, this is the top end of the sweet spot. The OnePlus 6T doesn’t include a swap space, so it will probably be hard for the average user to discern the difference between a 6GB device with swapping and an 8GB device without.
Note: I have simplified the discussion about when the swap space is used. While it is convenient to think about the swap space being used only when the available memory has been exhausted, the reality is that the use of the swap space is much more dynamic and complex.
More than 8GB?
Once you go over 8GB, you enter “Nonsense” land, where Mr. Silly lives. Even with 3GB of memory, like in my trusty Mate 8, we aren’t talking about what apps the device can run, we are looking at how many apps it can simultaneously keep in memory! 4GB is workable, 6GB is sweet, 8GB is edging close to Nonsense land, but still falls within the sweet spot. 10GB, 12GB, 16GB are just plain stupid. These are examples of nothing more than specification overload, which increases the price and brings little or no benefit to the user.
Once you go over 8GB, you enter ‘Nonsense’ land, where Mr. Silly lives.
Will we see devices with more than 8GB in 2019? Sure, in fact, we already have. That doesn’t mean they’re necessary. Personally, I would like to see consumers boycott any mobile device with more than 8GB. I know that might be wishful thinking. Sometimes the best phone, for other reasons like performance or camera, also comes with a stupid amount of RAM. However, the only influence consumers have over smartphone makers is in our decisions about which phones to buy.
I wish OEMs would act rationally, leave the RAM alone, and concentrate on more meaningful aspects of smartphone design.