使用iOS上的Memory Monitor,虚拟内存消耗与实际内存之间的差异 [英] Difference between virtual memory consumption and real memory with Memory Monitor on iOS

查看:976
本文介绍了使用iOS上的Memory Monitor,虚拟内存消耗与实际内存之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用中遇到了问题。我一直在测试,直到现在主要是在我的iPad 3上偶尔检查我的iPad 1以确保一切正常。



我正在我的应用程序中播放UIImageView动画,它在退出之前只保留已接收内存警告消息。



我一直在仪器中使用对象分配工具,但据此,我的内存使用率很低。所以在经过一段时间的研究之后,我发现了Larson先生的这篇文章:页面将让您更好地了解VM与实际内存之间的区别。



但这里有一个快速概述:
指针范围= 2 ^ 32 = 4GB这比任何设备上的物理内存都大(苹果已发货)。这是通过占用所有可用空间并将其分成4kb块来完成的。并非应用程序可以访问的所有内存都在物理内存中同时存在。这些4kb块是呼叫页面。您的分配将从更大的虚拟内存块中分离出来。然后这些虚拟内存对象被映射到物理内存。


I am stuck with an issue in my app. I have been testing up until now mostly on my iPad 3 with occasional checks on my iPad 1 to make sure all is well.

I am playing a UIImageView animation in my app and it keeps quitting with only a "Received memory warning" message before it quits.

I have been using the Object Allocations tool in instruments but according to that, my memory usage is way low. So after researching for a bit I came across this post by Mr. Larson: https://stackoverflow.com/a/5627221/329900

Now I am using the Memory Monitor tool instead. However, I don't understand why I am quitting. The 1st gen. iPad has 256MB of ram. Now I know I can't use all of that...some say you shouldn't use more than 100MB.

Is that real memory though, or virtual memory...or maybe some combination? My real memory is consistently between 20 - 25MB but the virtual is around 190 - 205MB when it crashes.

Here's a screenshot:

Anyone able to shed some light on this?

解决方案

The WWDC (Session 242) video found by searching for iOS App Performance: Memory in the WWDC 2012 Session Videos page will give you a better understanding of the difference between VM and real memory.

But here is a quick overview: A pointer Range = 2^32 = 4GB This is larger then the physical memory on any device(apple has shipped). This is done by taking all available space and dividing it up into 4kb chunks. Not all the memory your application can access is in physical memory at the same time. These 4kb chunks are call pages. Your allocations get split out of larger chunks of virtual memory. Then these virtual memory objects get mapped to physical memory.

这篇关于使用iOS上的Memory Monitor,虚拟内存消耗与实际内存之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆