简体   繁体   English

iOS,检查应用是否由于内存不足而崩溃

[英]iOS, check if the app crashes because of lack of memory

How can I make sure that reason of crashes is lack of memory? 如何确保崩溃的原因是内存不足?
Is there anything specific in crash log? 崩溃日志中是否有特定内容? Maybe I have to use some tools or libraries? 也许我必须使用一些工具或库?

UPDATE: my app uses lot of memory and receives memory warnings. 更新:我的应用程序占用大量内存并收到内存警告。 It's very difficult to reduce memory usage. 减少内存使用非常困难。 It crashes because of memory warnings time to time. 由于内存警告有时而崩溃。 But I want to make sure that it doesn't crash because of other reasons. 但是我想确保它不会由于其他原因而崩溃。
So how can I check the reason of app crash (it receives lots of memory warnings every time) 因此,我该如何检查应用崩溃的原因(每次都会收到大量内存警告)

UPDATE2: Application has lots of 3D graphics and complex UI that takes lots of memory for textures. UPDATE2:应用程序具有很多3D图形和复杂的UI,需要大量的纹理内存。 Customer doesn't want to make any kind of "loading..." pauses. 客户不想暂停任何“加载中...”。 If I unload invisible textures in background I can't get smooth animations. 如果在背景中卸载不可见的纹理,则无法获得平滑的动画。

So I just need to detect is there any crash reasons except memory . 所以我只需要检测是否有除内存以外的崩溃原因

You can use Apple's Instruments Tool to profile various things such as memory usage. 您可以使用Apple的乐器工具来分析各种事情,例如内存使用情况。 This tool is bundled together with Xcode. 该工具与Xcode捆绑在一起。

At least you could implement the method 至少您可以实现该方法

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application

in your app delegate, and put a log to see if this indeed you are going through it before crashing. 在您的应用程序委托中,并放置日志以查看您是否确实在崩溃之前正在经历它。

Product -> Profile -> leak is a possible method to check memory leak. 产品->配置文件->泄漏是检查内存泄漏的一种可能方法。 Allocations will show the total memory being used, and leaks will show leaks due to not releasing. 分配将显示正在使用的总内存,而泄漏将显示由于未释放而导致的泄漏。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM