如何解决较早启动但“由于内存压力而终止"的应用程序?现在? [英] How can I address an app that started earlier, but is "Terminated due to Memory Pressure" now?

查看:19
本文介绍了如何解决较早启动但“由于内存压力而终止"的应用程序?现在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Xcode 中开发 iOS 应用程序.早些时候我让它启动和运行,直到功能有限.然后是编译失败,声称未触及的样板生成的代码有语法错误.将源代码复制到新项目中会遇到不同的问题.

I am working on an iOS app in Xcode. Earlier I got it to start and run, up to a limited level of functionality. Then there were compilation failures claiming untouched boilerplate generated code had syntax errors. Copying the source code into a new project gets a different problem.

现在,我可以编译并开始运行,但它甚至在启动图像出现之前就指出应用程序由于内存压力而关闭.总视觉资产约为 272M,可以在不损害图形丰富性的情况下进行一些优化,并且是迄今为止该程序唯一预计较大的区域.(资产可能会或可能不会保存在内存中;例如,每个当前加载图像都被填充,我的代码从不以编程方式访问任何加载图像.)并且它在加载图像自身加载之前崩溃.

Right now, I can compile and start running, but it states before even the launch image shows up that the application was closed due to memory pressure. The total visual assets is around 272M, which could be optimized some without hurting graphical richness, and is so far the only area of the program expected to be large. (The assets may or may not be kept in memory; for instance every current loading image is populated and my code never accesses any loading image programmatically.) And it crashes before the loading image has itself loaded.

我该如何解决这个内存问题?我或许可以精简图像的处理方式,但我怀疑还有另一个根本原因.或者这是过度的内存消耗?

How can I address this memory issue? I may be able to slim down the way images are handled, but I suspect there is another root cause. Or is this excessive memory consumption?

谢谢,

推荐答案

查看 Apple 的 iOS 编程文档的性能调整部分.使用 Apple 的 Instruments 应用程序来确定如何、何时以及如何您的应用使用了多少内存.

Review the Performance Tuning section of Apple's iOS Programming documentation. Use Apple's Instruments application to determine how, when, and how much memory your app is using.

您应该考虑的一种方法是断开图形资源与您的应用程序的连接,并在您认为它们满足 iOS 的要求和限制后将它们一个一个地添加回来.

One approach you should consider is to disconnect the graphics resources from your application, and add them back one-by-one once you feel they meet the requirements and limitations of iOS.

现在,我的这部分回答是意见:听起来您的应用被 App Store 拒绝的风险很高,以防这是您要使用此应用的目标.

Now, this part of my answer is opinion: it sounds like your app is a high risk for being rejected from the App Store, in case that is your intended destination for this app.

这篇关于如何解决较早启动但“由于内存压力而终止"的应用程序?现在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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