为什么内存使用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.

Read: Premium Ethical Hacking and Programming courses online

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

时间: 2024-10-14 00:53:52

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

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

根据<Windows核心编程>得知:X86操作系统提供每个程序最多只有4G的虚拟内存,其中2G虚拟内存提供给系统用(具体用来干什么还待考察),还有2G的内存留给用户使用.那这2G内存能拿来干嘛呢?首先给你介绍程序内存的5大区:栈区,堆区,全局区(静态区),文字常量区,程序代码区.这5大区就只能可怜的蜗居在这2G的内存里,所以我们要好好的珍惜这2G内存了!大部分程序员在申请堆时都习惯使用new,因为它简单好用,但很多一部分程序员不清楚我能new多少内存!这时候就得看你的除了堆区其余4大分区占用了

在一台内存为2G的机器上,malloc(20G) 会怎样?如果是new(20G) 会怎样?

首先,malloc和new申请的都是虚拟内存 malloc函数的实质,有一个将可用的内存块连接起来的链表,调用malloc的时候,会沿着链表找一个满足用户需求的内存块.然后将这个内存块一分为二,一块和用户所申请的内存大小相同,另一块返回到链表中.如果用户申请一个大的内存块,空闲链表上可能没有可以满足用户要求的片段,这个时候malloc函数就会请求延时,对链表上的内存进行整理.如果还是不可以的话, 内存申请失败,返回NULL new的话,底层实现还是malloc,在分配失败的时候会抛出bad_al

Windows系统CPU内存网络性能统计第一篇 内存

最近翻出以前做过的Windows系统性能统计程序,这个程序可以统计系统中的CPU使用情况,内存使用情况以及网络流量.现在将其整理一下(共有三篇),希望对大家有所帮助. 目录如下: 1.<Windows系统CPU内存网络性能统计第一篇 内存> 2.<Windows系统CPU内存网络性能统计第二篇 CPU> 3.<Windows系统CPU内存网络性能统计第三篇网络流量> 本篇将介绍统计系统内存使用情况,包括内存使用率.总物理内存大小.可用物理内存大小.总虚拟内存大小,可用虚

C++中用new开辟内存空间和非new开辟内存空间的区别

#include <iostream> using namespace std; class A { private: int n; public: A(int m):n(m) { } ~A(){} }; int main() { A a(1); //栈中分配 A b = A(1); //栈中分配 A* c = new A(1); //堆中分配 delete c; return 0; } 复制代码 第一种和第二种没什么区别,一个隐式调用,一个显式调用,两者都是在进程虚拟地址空间中的栈中分配内存

【嵌入式开发】裸机引导操作系统和ARM 内存操作 ( DRAM SRAM 类型 简介 | Logical Bank | 内存地址空间介绍 | 内存芯片连接方式 | 内存初始化 | 汇编代码示例 )

[嵌入式开发]ARM 内存操作 ( DRAM SRAM 类型 简介 | Logical Bank | 内存地址空间介绍 | 内存芯片连接方式 | 内存初始化 | 汇编代码示例 ) 一. 内存 简介 1. 两大内存分类 ( 1 ) DRAM 简介 ( 定期刷新 | 速度慢 | 成本低 ) DRAM 简介 : 1.硬件描述 : DRAM 基本由一个个小电容基本原件组成, 电容的两端保留电荷; 2.优缺点描述 : ① 优点 : 成本很低, 很便宜; ② 缺点 : 需要 定期刷新数据, 速度较慢; a.

Linux环境编程之共享内存区(二):Posix共享内存区

现在将共享内存区的概念扩展到将无亲缘关系进程间共享的内存区包括在内.Posix提供了两种在无亲缘关系进程间共享内存区的方法: 1.内存映射文件:由open函数打开,由mmap函数把得到的描述符映射到当前进程地址空间中的一个文件.(上一节就是这种技术) 2.共享内存区对象:由shm_open打开一个Posix名字(也许是在文件系统中的一个路径名),所返回的描述符由mmap函数映射到当前进程的地址空间.(本节内容) Posix共享内存区涉及以下两个步骤要求: 1.指定一个名字参数调用shm_open

SQL SERVER 2012 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。 (System.Data)

标题: 连接到服务器------------------------------无法连接到 192.168.1.253.------------------------------其他信息:尝试读取或写入受保护的内存.这通常指示其他内存已损坏. (System.Data)------------------------------按钮:确定------------------------------管理员身份运行 cmd -> netsh winsock reset***************

C++ 内存、new与malloc分配内存区别?

一关于内存 1.内存分配方式 内存分配方式有三种: (1)从静态存储区域分配.内存在程序编译的时候就已经分配好,这块内存在程序的整个运行期间都存在.例如全局变量,static变量. (2)在栈上创建.在执行函数时,函数内局部变量的存储单元都可以在栈上创建,函数执行结束时这些存储单元自动被释放.栈内存分配运算内置于处理器的指令集中,效率很高,但是分配的内存容量有限. (3) 从堆上分配,亦称动态内存分配.程序在运行的时候用malloc或new申请任意多少的内存,程序员自己负责在何时用free或de

C语言内存、存储机制、计算机内存分配机制

1. 大师讲的很详细:http://blog.csdn.net/youoran/article/details/10990815 2. 讲的还行:http://blog.csdn.net/wind19/article/details/5964090 3. 不错:http://blog.csdn.net/cc_net/article/details/11097267 ———————————————————————————————————— 1. 编译器编译时分配内存,程序运行是分配内存. 2. 变