Virtual RAM is no longer foreign to the world of smartphones. While the feature has been in action for PCs for a long time, it’s only recently that we’ve seen its widespread use on smartphones. Phone makers use several marketing terms to advertise the feature on their phones, but it’s basically the same thing every time. Mid-range phones introduced the virtual RAM feature first, but it is slowly coming to high-end phones as well. But what is virtual RAM? Here is an explanation to help you.
What is Virtual RAM?
The term virtual RAM refers to RAM that is not physically present on your device (like normal RAM), but is used when needed. For those who don’t know, RAM (or Random Access Memory) is a high-speed storage component responsible for temporarily storing your data. This is different from your internal storage, where data is stored permanently. The RAM is much faster than eMMC or UFS 3.1 storage used for extended storage. Basically, while internal storage stores data like pictures and videos, RAM remembers what apps you opened and what you were doing the last time you opened them.
By doing so, the RAM allows you to load applications as quickly as possible. Every time you open an app, it’s stored in RAM, so you can access it quickly. So technically, more RAM allows you to have more apps running in the background and reopen them quickly with minimal lag or delay.
The idea of virtual RAM is to provide additional RAM when needed – but how does it do this without physically adding more RAM? Using onboard storage as RAM. How do you know if you have this? Well, each manufacturer has come up with their own marketing terms, so you might have to dig a little deeper. For example, Samsung calls it RAM Plus, Realme uses the term Dynamic RAM Expansion, and Vivo calls it Virtual RAM.
How does virtual RAM work on Android?
How does virtual RAM work? The simple answer is that it allocates a certain amount of space from your main storage – so 4GB, 6GB, etc. But, to fully understand how virtual RAM works, we must first understand how memory management works on Android.
An Android device comes with three types of memory – RAM (LPDDR4, LPDDR4x), internal storage (eMMC or UFS) and zRAM, the latter being basically a partition inside your RAM that stores low-priority compressed data being executed in context. This is done to leave space on your RAM for the app or apps running in the foreground.
Android uses a process called paging for memory management. In paging, RAM is divided into small chunks called “pages,” which are usually about 4 KB each. The amount of RAM used is determined by the number of free or actively used pages. On Android, you see this information under recent apps. If you haven’t noticed it yet, the image below will help you.
Pages are defined in two types: “own pages” and “modified pages”. Clean pages have an unmodified copy of the data stored in storage, while dirty pages keep a modified copy. An unmodified copy is static data that does not change, while a modified copy is dynamic data that changes moment by moment. Android can get rid of clean pages when they don’t need to access resources, freeing up RAM space.
It sounds complicated, but it’s easier to understand through a few concrete examples. Apps like Facebook, Twitter, and Reddit use clean pages and tend to remain static when placed in the background. For example, when you launch Facebook and switch to Twitter later, Facebook is stored in your phone’s RAM, but it doesn’t refresh in the background. So when you return to Facebook, it shows the timeline you left before refreshing.
On the other hand, music streaming apps and YouTube use dirty pages, so they continue to work even when the app is not open. As such, these apps use RAM dynamically and cannot be closed. So, to save space, these apps are compressed and sent to zRAM, making sure the app stays open in the background.
Virtual RAM uses internal storage on your device by creating a swap partition that acts like zRAM. Budget phones come with a limited amount of RAM, so manufacturers use this technique to virtually expand the RAM. It should be noted that the feature does not increase the physical RAM present on the device. So even if you enable the virtual RAM feature, the amount of physical RAM will remain the same.
Is virtual RAM good for your phone?
The Virtual RAM feature lets you run more apps on your phone, but it’s not often seen on flagship smartphones. Why? Because taking advantage of storage space like this makes the most sense on an entry-level device that has a limited amount of RAM to begin with. High-end Android devices now tend to come with 12GB or 16GB of RAM, which is already a huge amount of RAM, so functionality is less likely to matter here.
It should also be noted that the feature involves constant reading and writing which is not good for flash memory as they have limited read and write cycles. Frequent use of internal storage for virtual RAM therefore reduces the lifespan of your storage.
Why are we seeing virtual RAM features on phones now?
Virtual RAM has been around for a while now, but not on smartphones. PCs come with this feature built-in, and only rooted smartphones allowed this feature. But we’ve recently seen manufacturers start shipping phones with this feature built-in. This is probably because applications are much larger these days and use more resources, including RAM. Therefore, this feature provides users with more RAM, without the need to add more physical RAM to a smartphone (increasing costs).
So is this a good thing? Not really, as this feature may do more harm than good when it comes to the lifespan of internal storage. This is one of the main reasons why Google has avoided this feature for so long, as the Android developer page points out. “On Android, storage is not used for swap space as it is on other Linux implementations, because frequent writing can wear out that memory and shorten the lifespan of the media. of storage.”