为什么内存使用2G的苹果手机比内存使用4G的安卓机更流畅?

Posted STM32STM32STM32

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了为什么内存使用2G的苹果手机比内存使用4G的安卓机更流畅?相关的知识,希望对你有一定的参考价值。

这是在国外一家网站看到的,分析得不错,原文如下:

Why does the iPhone require less RAM than android devices?

There are people who always fight when it comes to comparing the Android devices vs iPhone. Iphones are way more expensive than Android devices even with the same specifications. However, the iPhone works a lot smoother and faster than an Android device with the same amount of RAM. That means an iPhone with 2GB RAM works much faster than an Android device with 2GB RAM with same features.

If you compare the performance of iPhone 7 (2GB RAM) with Google Pixel  (4GB RAM) or Samsung s7 (4GB RAM), You’ll see no difference in performance. iPhone 6 was the best performing phone in its time with just 1 GB of RAM. Now, the question is why does the iPhone require less RAM than Android devices? Why does the Android device need more RAM?

Why does the iPhone require less RAM than Android devices?

 

It involves many factors. Basically the Garbage collection, App Management, User Interface, and Hardware.

 

1. Garbage collection

In the case of Android, since it involves garbage collection it requires more memory. The Android apps use Java and as a result, Android does garbage collection. The problem with garbage collection is that memory usage grows until it’s collected, so there might be more memory allocated than necessary. That’s bad for devices with restricted memory and no option to swap.

When the garbage collector runs, it scans the heap to find memory that’s no longer being used, and that’s an expensive process, that slows down the device until is has completed.

The iPhone do not use Garbage Collection. It uses Automatic Reference Counting, which is an innovative way of managing Objective-C objects on ios. It does away with explicit retain, release and autorelease messages, and it behaves the same on both platforms.  Unlike garbage collection, ARC does not handle reference cycles automatically. This means that as long as there are “strong” references to an object, it will not be deallocated. Strong cross-references can accordingly create deadlocks and memory leaks. It is up to the developer to break cycles by using weak references.

 

Here is the full Difference between ARC vs Garbage Collection

2. User Interface

An Android user often complains about phone lag but the iOS UI runs so smooth. The main reason is that the iOS UI rendering happens in a separate thread with real-time priority but on Android, this happens in the main thread with normal priority. This means that other apps in Android can take over the processor resources and hurt basic UI interactions, translating into a noticeable lag.

3. App management

Android lets developers run processes in the background more freely than iOS. iOS kills any process when it thinks it doesn’t need to be running. Apps that play music in the background or similar can stay alive.

Android gives a lot of freedom to app developers that cause memory leaks or resource hogging background processes which means you need to be careful what you install on your Android device. Android has made some attemps to control this, such as killing apps that use too much CPU, but still, these problems can be noticed by the user.

The iOS puts a lot of limitations on the developers and what they can do causes them not to do much harm.

4. Hardware

Apple’s iOS is optimized to run on the hardware, which is also designed and tested by Apple, and manufactured by Apple’s manufacturing partners. Android doesn’t have that level of control because the software OS developers are separate from the hardware makers

以上是关于为什么内存使用2G的苹果手机比内存使用4G的安卓机更流畅?的主要内容,如果未能解决你的问题,请参考以下文章

安卓手机怎么用3g网络?

如何让安卓手机强制4G网络模式

程序最多能new多少内存(2G内存里要放程序的5大区,HeapAlloc比new要快多了,而且超过2G的时候会告诉你)

vmware 虚拟机实际使用的内存超过分配的内存在使用啥?

安卓6G运存手机敌不过苹果1G运存?买手机运存究竟几G才合适?

苹果125g怎么切换4g