简体   繁体   English

我的iOS应用程序应定位多少内存?

[英]What amount of memory should I target for my iOS app?

I am currently showing that my app is using a maximum of 200MB when it is running. 我目前正在显示我的应用程序在运行时使用的最大内存为200MB。 Is there a way to tell if this is going to trigger a low memory warning? 有没有办法判断这是否会触发内存不足警告? So far I have not had any issues with the simulator or actuall devices. 到目前为止,模拟器或实际设备还没有任何问题。

We must avoid spiking the memory. 我们必须避免增加记忆力。 For example loading images from disk or cache in loop. 例如,从磁盘或缓存中循环加载图像。 This will create a memory spike and it is at this point iOS starts to throw low memory warnings. 这将导致内存峰值,并且此时iOS开始引发内存不足警告。 The exact amount of memory is not specified by Apple. Apple未指定确切的内存量。 In many applications I have observed that as the memory grows gradually iOS is comfortable and app works properly. 在许多应用程序中,我观察到随着内存的逐渐增长,iOS变得很舒适,并且应用程序可以正常运行。 But if memory spike occurs low memory warning is thrown. 但是,如果发生内存高峰,则会引发内存不足警告。

Apps can use 200 MB of memory these days easily, how ever it is important to simulate and handle low memory warnings in order to be on the safe side. 这些天,应用程序可以轻松使用200 MB内存,因此,为了安全起见,模拟和处理内存不足警告非常重要。

If you want to trigger low memory warning using simulator, there is a option of doing so in the Menu->Debug of Simulator (Cmd+Shift+M). 如果要使用模拟器触发内存不足警告,可以在菜单->模拟器调试(Cmd + Shift + M)中进行选择。 In device you may load some big images in a for loop. 在设备中,您可能会在for循环中加载一些大图像。 You may also call a private method. 您也可以调用私有方法。 [[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)]; [[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)]; Just be sure that this code does not go to production as Apple will reject the binary as private method is being used. 只需确保此代码不会投入生产,因为当使用私有方法时,Apple将拒绝该二进制文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我应该为我的ios应用程序使用什么类型的数据存储? - What type of data store should I use for my ios app? 我应该怎么做才能使我的应用适应iOS 5.0,并保持与iOS 4的兼容性 - What should I do to adapt my app to iOS 5.0 keeping compatibility with iOS 4 如果我将 iOS 应用程序目标从 iOS 11 升级到 iOS 13,13 岁之前的用户会发生什么? - If I upgrade my iOS app target from iOS 11 to iOS 13, what happens to pre-13 users? 如果我想为我的iOS应用启用“个人资料”功能,该怎么办? - What should I research if I want to enable “profile” features for my iOS app? iOS应用程序可能泄漏的最大内存量 - Maximum amount of memory that can be leaked for iOS app 获取iOS中应用程序使用的内存量 - Get amount of memory used by app in iOS 我的iOS应用标识符应与我的配置文件一起使用? - What should my iOS app identifier be to work with my provisioning profile? 我应该为Hudson构建我的iOS应用程序使用哪种配置文件? - What sort of provisioning profile should I use for Hudson building my iOS app? 考虑制作一个开源iOS应用程序,我应该在.gitingnore中添加什么? - Thinking of making an opensource iOS app, what should I put in my .gitingnore? 如何判断哪些对象专门消耗了我的 iOS 应用程序中的所有内存/RAM? - How do I tell what objects are specifically consuming all the memory/RAM in my iOS app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM