Android vs iPhone memory mangement two phones one next to the other

Apple vs Android RAM management: Who does it better?

The amount of Random Access Memory (RAM) your handset needs for smooth multitasking is a cloudy subject, especially as Apple and Android phones have different amounts. Smartphones rely on RAM to hold the operating system (like Android and iOS), and to run apps and the data for those apps, as well as some caching and buffering data. The RAM needs to be organized and managed so that the apps can run smoothly. When a new app is launched, a free place in memory needs to be found to load the app and start it running. Equally, when an app exits, the space it occupied needs to be returned to the OS.

All is well, as long as there is enough free RAM to start apps. But what happens when there isn’t enough free memory? How does iOS handle such situations? What about Android?

See also: How much RAM does your Android phone really need in 2022?

A little history of Apple vs Android RAM management

Back in the early days of Android and iOS, smartphones didn’t have much RAM and there was not much difference in the RAM sizes between an iPhone and an Android phone. The HTC Dream, from 2008, had just 192MB of RAM, and the original iPhone packed 128MB.

The iPhone 3G stuck with 128MB and the iPhone 3GS, from 2009, doubled that to 256MB. It was doubled again with the iPhone 4 and doubled once more with the iPhone 5 (2012). iPhones continued to come with 1GB of RAM until 2015 when Apple released the iPhone 6S, which came with 2GB of RAM. Zoom forward to 2021 and the iPhone 13 Pro includes 6GB of RAM.

In the Android ecosystem, the Samsung Galaxy S (from 2010) came with 512MB of memory, and the S2 had 1GB. The S3, from 2012, had variants with 2GB, as did the S4 from 2013. This is where we see the RAM sizes in the iPhone and in Android devices diverge significantly. Samsung put 2GB in the S4, two years before Apple included 2GB in the iPhone 6S. Fast forward to 2021/2022 and we have Android devices with 16GB of RAM, such as the Samsung Galaxy S22 Ultra.

Check out: The best phones with 16GB of RAM

iPhones have less RAM but does that mean they’re better optimized?

Such a difference in RAM sizes leads to statements like “iPhones are better optimized — they don’t need as much RAM as Android phones”. On the face of it, this seems like a logical statement. But it isn’t quite as simple as that. It has less to do with optimization, and more to do with Android’s decision to use Java.

Objective-C/Swift vs Java/Kotlin

MacBook Air running XCode

Gary Sims / Android Authority

When a developer writes an app for iOS, it is compiled directly to code that can run on the iPhone’s processor. This is known as native code, as it doesn’t require any kind of interpretation or virtual environment to run. Android, on the other hand, is different. Android uses Java. When Java code is compiled, it’s turned into an intermediate code (Java Bytecode) that is processor independent. The same Java Bytecode can run on an Arm processor, an x86 processor, or a RISC-V processor. Java’s slogan is “Write once, run anywhere”. This has enormous benefits for cross-platform compatibility.

The different programming languages used by Android and iOS require different amounts of RAM.

However, Java comes with a downside. Each operating system and processor combination needs a runtime environment, known as the Java Virtual Machine (JVM), that understands Java Bytecode and can convert it to the native code of the processor. Originally, this was done by interpretation, meaning each chunk of Bytecode was read, and then executed, and then the next chunk was read, and so on. Over time, different techniques were invented to speed up this process, including caching of previously converted chunks, just-in-time compilation into native code, ahead-of-time compilation, and so on.

But, no matter how good these techniques are, two problems remain. First, native code performs better than code running via the JVM. Second, the use of the JVM (even when using ahead-of-time compilation) increases the amount of RAM an app uses.

Here is a table of the RAM used by different apps running on iOS and Android:

App nameiOS (MB)Android (MB)
App name

Play Store/App Store

iOS (MB)

235

Android (MB)

217

App name

Acrobat Reader

iOS (MB)

117

Android (MB)

390

App name

Booking.com

iOS (MB)

73

Android (MB)

330

App name

Gmail

iOS (MB)

190

Android (MB)

259

App name

Google Maps

iOS (MB)

224

Android (MB)

300

App name

YouTube

iOS (MB)

176

Android (MB)

282

App name

eBay

iOS (MB)

69

Android (MB)

300

App name

Google Photos

iOS (MB)

136

Android (MB)

281

App name

Twitter

iOS (MB)

100

Android (MB)

366

As you can see, the iOS apps tend to use less RAM — up to 70% less, in some cases. If you take the average, it is around 40% less RAM. That means, if everything else is equal, an iPhone will need 40% less RAM to hold the same number of apps in memory as an Android phone. If the iPhone 13 Pro has 6GB, then a flagship Android device would need 8GB to run the same apps.

However, all is not lost! Not all apps use the JVM. There are native apps for Android. They tend to be games, as games don’t use the Android UI or the various Android frameworks. Android provides a way for game writers to compile their source code directly to native binaries. Code that runs directly on the processor without the JVM. All of the popular gaming tools, like Unity and Unreal, work by compiling code to run natively, no JVM required.

If everything else is equal, an iPhone will need 40% less RAM to hold the same number of apps in memory as an Android phone.

Here is a table of the RAM used by different games running on iOS and Android:

GameiOS (MB)Android (MB)
Game

Subway Surfers

iOS (MB)

500

Android (MB)

761

Game

1945 Airforce

iOS (MB)

550

Android (MB)

852

Game

Candy Crush

iOS (MB)

219

Android (MB)

289

Game

Brawl Stars

iOS (MB)

572

Android (MB)

507

Game

Minecraft

iOS (MB)

462

Android (MB)

803

Game

Asphalt 9

iOS (MB)

749

Android (MB)

803

Game

Shadowgun Legends

iOS (MB)

1130

Android (MB)

899

Game

Elder Scrolls Blade

iOS (MB)

1030

Android (MB)

952

Game

Genshin Impact

iOS (MB)

1270

Android (MB)

1400

The results are quite different from the apps. Here we can see games that use less memory on Android (up to 20% less) and some which use more. On average, iOS games use 10% less RAM than the Android versions. This shows the difference between using the JVM and the Android UI, compared to writing native games. That 10% is a significant number, but once things get this close we need to start to look at compiler versions, screen resolutions, texture compression, texture resolutions, Open GL ES, Metal, and so on. The bottom line is that for gamers, the amount of RAM needed is similar on iOS and on Android.

How much RAM is ideal for an iPhone?

When considering the ideal amount of RAM for a smartphone, it is important to define what we mean by “ideal”. Running one app on an iPhone, even an older model, isn’t a problem. The question is, how many apps or games can remain in memory simultaneously? In other words, how many apps can you actively switch between, without them needing to reload? How many apps or games do you use multiple times during the day? It would be a very poor user experience if you sent an email, played a quick game, posted something on social media, and then returned to your email app to find that it needed to reload. Such a limitation would become frustrating very quickly.

So “ideal” is partially defined by how you use your iPhone. Productivity? Gaming? Social media? Video editing? Photography? And so on…

If not enough memory was freed using compression, then iOS will jettison an app from RAM to reclaim its memory

If, when you start an app there is not enough free memory for it, then iOS does one of two things. First, it tries to compress some memory blocks (called pages) that haven’t been used for a while. iOS takes some of those pages, compresses them (using a special compression algorithm called WKdm), and then writes them back into memory. If you have 128K of eligible pages, and assuming 50% compression, then 128K can be compressed to 64K, freeing up 64K.

Second, if not enough memory was freed using compression, then iOS will jettison an app from RAM to reclaim its memory. This is known as a jetsam event. If you switch back to a jettisoned app then it will need to reload.

Here is a chronological graph showing the amount of RAM used, and the amount of compressed RAM, as different apps are started and used on an iPhone SE (2020) with 3GB of RAM:

At the start, iOS has only compressed around 200MB of RAM and just over 2GB of RAM is being used. Then, as different apps are started, the amount of RAM used increases, and the amount of compressed RAM increases. You can see the first significant spike when the Booking.com app is started. There is another bump when Google Photos is started, and now iOS is using over 1GB of compressed RAM. By the time I started Tasty, over a dozen apps were in memory and none had been jettisoned. To put more memory pressure on the system I opened Safari and started browsing different websites, each in its own tab. At this point, Safari was using 850MB of RAM, and iOS was forced to jettison Keynote from memory.

As we discussed earlier, games use a lot more memory than apps. The same iPhone SE can hold about four games in memory (Subway Surfers, 1945 Airforce, Candy Crush, Brawl Stars) at the same time. However, starting the fifth game, Asphalt 9, caused iOS to jettison two games (Subway Surfers and 1945 Airforce) to make room for it.

When there is more RAM, apps and games are jettisoned less often. Here is a graph for the iPhone 13 Pro (with 6GB of RAM) showing how it handles multiple games in memory:

The iPhone 13 Pro can hold more games in memory simultaneously than the iPhone SE. It has double the RAM, so that is to be expected. The latter games are quite large, with some of them taking over 1GB of RAM. When Genshin Impact was started, iOS couldn’t compress any more memory pages (over 2GB of memory was already compressed at this point) and so it was forced to terminate Subway Surfers, 1945 Airforce, and Brawl Stars, in favor of the new game.

A 3GB iPhone is fine for basic use but you’ll want more for gaming.

One final aspect to consider is future-proofing. Genshin Impact is a huge game and takes up over 1.2GB of RAM on iOS. It was released in 2020. Who knows what games will appear in the next few years! iPhone gamers should factor in some kind of buffer and buy a device with the most memory possible.

The answer

For those who just use productivity apps and social media (without much browsing) then 3GB is enough. If you are looking to buy a new iPhone, but not the iPhone SE, then all of the 4GB models will be adequate. If you do a lot of browsing or multimedia stuff then 4GB will work, but you should consider a model with 6GB.

If you are a heavy gamer, plus you want to future-proof your device, you should strongly consider an iPhone with 6GB of RAM.

How much RAM is ideal for Android?

We have already seen that Android apps tend to use more memory. This means that Android itself, including its standard apps, will use more memory. The result is that Android is going to be more RAM hungry from the start.

When an Android device doesn’t have enough memory to start a new app or game, it uses a very similar technique to that of iOS — it compresses the memory pages. In Android, this is known as swapping to zRAM, following the Unix/Linux tradition of using “z” to denote compression.

A 4GB Pixel phone can run all the apps from the table above (from the Play store through to Twitter) and all the apps remain in the memory, so you can switch between them freely without any reloads.

See also: Android 12 review — It really is all about you

Gaming is a little different when you have only 4GB of RAM on Android:

The Pixel 3 XL comes with 4GB of RAM, but only 3,579MB is available. Seems like it should have been labeled as 3.5GB, not 4GB! Notice how almost all the memory is being used from the start. As the games are started then the memory compression (swapping to zRAM) increases. When Brawl Stars is launched there is more than 1.5GB of compressed RAM being used, but it still isn’t enough and Subway Surfers is killed.

More RAM means more games can stay in memory at the same time. As you can see, 12GB is more than enough for hardcore Android gamers. All the games from Subway Surfers to Genshin Impact remained in memory. The S21 Ultra didn’t start to use all of the onboard memory until Shadowgun Legends was started, and then there is a corresponding increase in the amount of zRAM used.

Even when the final game is loaded and played, none of the other games are removed from memory. In fact, to force Android to remove a game I needed to start Chrome and open 12 tabs. Only then did Android kill Minecraft!

Looking back: The history of Android — The evolution of the biggest mobile OS in the world

The answer

An Android device with 4GB of RAM will be usable if you only use a handful of apps and don’t do much web browsing or gaming. Aim for 6GB of RAM when buying a mainstream smartphone, as this will allow for productivity and social media apps, along with a moderate number of tabs for browsing, plus some gaming.

4-6GB is enough for Android but 12GB models are extremely robust for power users.

For upper-mid-range or high-end devices, 8GB will provide a good multitasking experience plus some future-proofing. 12GB RAM on the Galaxy S21 Ultra is clearly a sweet spot for gamers and power users. 12GB also offers good future-proofing. At this time, 16GB RAM seems to be nothing more than just bragging rights.

Which is better: iOS or Android?

Android vs iPhone memory mangement two phones one next to the other

Gary Sims / Android Authority

Both Android and iOS use in-memory compression to help squeeze some extra capacity from the physical RAM. The two operating systems do this on the fly, and both need to uncompress any compressed memory before it can be used again. In terms of the technology, one is just as good as the other, while noting that in general, Android tries to compress more before it resorts to killing off existing apps in memory.

However, because iOS uses native code and not an intermediate language, iOS apps and iOS itself tend to be smaller. This distinction is less significant when dealing with games, but it is still a big factor.

If you are a heavy gamer, plus you want to future-proof your device, you should strongly consider an iPhone with 6GB of RAM.

In a nutshell, 6GB in the iPhone 13 Pro is enough for power users and gamers. It didn’t do as well as the S21 Ultra, but then again the S21 Ultra has twice the memory capacity. But a 6GB iPhone does much better than a 6GB Android device.

Knowing that Android needs more memory, you will need an 8GB Android device to be on the same level (in terms of memory management) as a 6GB iPhone.

Source link

Similar Posts