What Is Virtual RAM in Android and Should You Care (2024)

Apart fromhuge camera megapixelsandhigh refresh rate displays, the biggest trend in the smartphone world seems to be Virtual RAM. Some refer to it as Dynamic RAM expansion, while others call it Extended RAM. Regardless of what it’s called, the idea remains the same. Allow users to use some part of their storage as RAM to help multitask.

What Is Virtual RAM in Android and Should You Care (1)

We will discuss in this guide how memory management in Android works and how the idea of Virtual RAM differs from it. We will try to ponder whether Virtual RAM is even required on Android or not. So let’s get to it.

How Memory Management Works on Android

First things first, it’s important to understand how Android manages your memory. Within Android, there are 3 types of memory. First is your RAM, then you have zRAM, and finally your storage. RAM is the basic memory module inside which all apps run. Then there’s your onboard storage, either UFS or eMMC on budget devices. Finally, we have zRAM. Essentially, zRAM is a partition inside of RAM.

The idea behind zRAM is that low-priority data on RAM is compressed and stored inside zRAM. Because RAM is any day faster than your normal storage, having compressed data inside zRAM, which is a part of RAM, is still going to be faster than accessing it off your storage, even if you count the compressing and uncompressing times.

What Is Virtual RAM in Android and Should You Care (2)

Now that we’ve established the 3 different types of memory available to Android let’s understand how the OS handles it all. So Android makes use of paging techniques. How it functions is that RAM is broken into pages, where each page is typically of 4KB. Whether that page is free or actively used, they combine to show used RAM and unused RAM, respectively. Then, the kernel’s task is to convert used memory into free memory. It does so by shifting the data on those used pages to your storage.

What Is Paging and How It Works

To understand how it works, let’s understand the kinds of pages. You can classify Pages into two types – Clean and Dirty pages. The clean pages have an unmodified copy saved in the storage space. Meanwhile, dirty pages have a modified copy of data stored in storage. Now, what is this modified and unmodified? Let’s call it dynamic use of your memory.

Unmodified copies are static data, while modified copies are dynamic data changes every second. Android can purge the clean pages when needed since they’re not dynamically accessing the resources. That helps to free up the RAM and make more of it available. That might sound a bit too technical, so let’s make it simpler to understand using real-world applications.

What Is Virtual RAM in Android and Should You Care (3)

Suppose you open Twitter, browse through your feed, and then switch to something else. Twitter is still there in your RAM. But if you don’t open it for a while, its priority decreases. Later on, if you launch something new, Android will have to free the memory that Twitter is using. So what it does is that it shifts its values and data to the storage, and gives you free space. This is why when you launch Twitter again, it will first show you the timeline that it was hibernated at, and then refresh. The same is for Facebook, Reddit, or similar apps like Calculator or Notes. These apps use Clean pages since a copy of their data is statically saved inside your storage.

What Is Virtual RAM in Android and Should You Care (4)

Now, for dirty pages, consider Spotify or any music player. You start some music inside the player and then keep it running in the background without opening the app. However, the system cannot close it since it’s dynamically using your memory. As a result, Android compresses the app and shifts it to zRAM when more free RAM is required.

What Is Virtual RAM

Now that you’ve know how Android manages memory, you must wonder – where does the Virtual RAM feature comes in? Remember how we said that zRAM is also a part of RAM? The way Virtual RAM works is that it creates a swap partition on your storage space, and uses it as extra zRAM.

What Is Virtual RAM in Android and Should You Care (5)

Because zRAM is stored on your RAM only, there’s a limit to the number of pages you can compress and store in it. With a swap partition, you can use your storage space as extra zRAM, for compressing and shifting apps, while making space available in your actual RAM.

Is This Feature New

So, is all of this new? Well, not really. Linux has been using swap partitions since the beginning. For Android, custom kernel users have been using their SD Cards to create additional swap partitions to improve memory management.

As such, brand manufacturers are just giving you the same feature baked inside their Android skins. However, it does beg the question – if the feature is so helpful, why hasn’t it been a part of Android’s source code?

Is Virtual RAM Good or Bad

The answer lies in the very basic working of Virtual RAM itself. While the feature does allow you to run more apps on your device by compressing hibernated apps and shifting them to your storage, it does more harm than good. Because swap partitions are essentially storing active apps, there’s a higher sense of reading and writing involved.

This works fine on traditional storage, but flash memory has a limited number of reads and writes. So by using SWAP or Virtual RAM, you are technically lowering your device storage’s life span.

This is also highlighted well onAndroid’s developer page. “On Android, storage isn’t used for swap space like it is on other Linux implementations since frequent writing can cause wear on this memory and shorten the life of the storage medium.” Another example of this is in the new Apple M1 MacBooks. Those machines use a swap partition on Apple’s SSDs, for which users have been complaining quite a lot.

Does Virtual RAM Matter and Should You Use It

Essentially, it all depends on how you define multitasking. If it is juggling between just two to three active apps, then sure, virtual RAM does help with that. But if you keep switching between 5-6 heavily active apps, virtual RAM won’t do anything because it would keep shifting the apps.

At its core, the virtual RAM feature does allow you more RAM space available for apps to run. However, it comes at the cost of your storage. If you intend to keep using your device for more than two years, we reckcon that using virtual RAM might not make much sense.

I am an enthusiast with in-depth knowledge of smartphone technology and memory management, supported by practical experience and a comprehensive understanding of the concepts involved. My expertise extends to the intricate details of Android memory management, including RAM, zRAM, and storage, as well as the evolving trends in smartphone features such as high camera megapixels, high refresh rate displays, and the Virtual RAM phenomenon.

In the article you provided, the discussion revolves around the trend of Virtual RAM in the smartphone world, particularly in Android devices. Let me break down the concepts mentioned in the article:

Memory Management in Android:

  1. RAM (Random Access Memory): This is the primary memory module where all apps run.
  2. zRAM: A partition inside RAM used for compressing low-priority data, making it faster to access than regular storage.
  3. Storage: Onboard storage, either UFS or eMMC, where data is stored persistently.

How Android Manages Memory:

  1. Paging Techniques: RAM is divided into pages, typically 4KB each. Clean pages have unmodified data stored in storage, while dirty pages have modified data.

  2. Clean Pages vs. Dirty Pages: Clean pages contain static data, and Android can purge them to free up RAM. Dirty pages hold dynamic data that changes frequently, and they are compressed and shifted to zRAM when more free RAM is needed.

Virtual RAM:

  1. Definition: Virtual RAM, also known as Dynamic RAM expansion or Extended RAM, creates a swap partition on storage and uses it as extra zRAM.
  2. Purpose: It allows users to use part of their storage as additional RAM, increasing multitasking capabilities.

Is Virtual RAM Good or Bad:

  1. Benefits: It enables running more apps by compressing and shifting hibernated apps to storage.
  2. Drawbacks: It can lead to increased reading and writing on storage, potentially shortening its lifespan, especially with flash memory.

Considerations and Recommendations:

  1. Historical Context: Linux has used swap partitions, and some custom kernel users in Android have employed SD Cards for additional swap partitions.
  2. Concerns: Frequent writing to storage can cause wear and shorten the life of flash memory.
  3. Decision to Use Virtual RAM: Depends on individual usage patterns; beneficial for light multitasking but may not be ideal for heavy multitasking if the intention is to use the device for an extended period.

In summary, while Virtual RAM can provide additional RAM space for multitasking, users should weigh the benefits against potential drawbacks, especially regarding the impact on storage lifespan. The decision to use Virtual RAM depends on individual usage habits and long-term device usage plans.

What Is Virtual RAM in Android and Should You Care (2024)
Top Articles
Latest Posts
Article information

Author: Lakeisha Bayer VM

Last Updated:

Views: 6372

Rating: 4.9 / 5 (49 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Lakeisha Bayer VM

Birthday: 1997-10-17

Address: Suite 835 34136 Adrian Mountains, Floydton, UT 81036

Phone: +3571527672278

Job: Manufacturing Agent

Hobby: Skimboarding, Photography, Roller skating, Knife making, Paintball, Embroidery, Gunsmithing

Introduction: My name is Lakeisha Bayer VM, I am a brainy, kind, enchanting, healthy, lovely, clean, witty person who loves writing and wants to share my knowledge and understanding with you.