模拟器和设备之间的应用程序内存使用差异

App memory usage difference between simulator and device

我 运行 我的应用程序在我的 Macbook Air 和我的 Iphone 6s 上,下图是我在我的应用程序中完成所有 UI 后的内存使用情况。在这两个场景中,我执行了类似的任务和持续时间。为什么模拟器内存​​使用率比实际设备高很多。即使设备内存使用似乎合理,我是否应该担心?

好Question.I谢谢你提出这样的问题。

Apple Documentation says

Simulator is a useful tool, but it should not be the only way you test an app. Because the simulator is an app running on a Mac, it has access to the computer’s resources, including the CPU, memory, and network connection. All of these resources are likely to be faster than those found on a mobile device. As a result, the simulator is not an accurate test of an app’s performance, memory usage, and networking speed. For this same reason, always test the performance of your app’s user interface on a device. In Simulator, your app’s user interface may appear to run both faster and smoother than on a device

Xcode’s iOS simulator reports 2GB RAM for iPhone 6S, 4GB for iPad Pro

Xcode's iOS simulator shows 2GB of RAM for iPhone 6s and 6s Plus, 4GB for iPad Pro

最终讨论的解决方案是

Why the iPhone Simulator is Awesome

我从jbat100的回答中找到了确切的解决方案。

Rendering performance of OpenGL ES in Simulator has no relation to the performance of OpenGL ES on an actual device. Simulator provides an optimized software rasterizer that takes advantage of the vector processing capabilities of your Macintosh computer. As a result, your OpenGL ES code may run faster or slower in iOS simulator (depending on your computer and what you are drawing) than on an actual device. Always profile and optimize your drawing code on a real device and never assume that Simulator reflects real-world performance.

Iphone Simulator - Allocates way too much memory and runs slow compared to device