简体   繁体   English

在使用iOS 7的Xcode 5中运行应用程序时,内存大小不断增加

[英]Memory size was keep on increasing while running application in Xcode 5 with iOS 7

I am implementing an iPhone application and when I ran this app initially it was showing memory size was 5.3MB 我正在实现一个iPhone应用程序,当我最初运行这个应用程序时,显示内存大小为5.3MB

在此输入图像描述

and after 10 min it was showing memory size was 185.3 MB. 10分钟后显示内存大小为185.3 MB。

在此输入图像描述

I'm releasing objects manually and also analyzed my app, I have only one memory leak(that to return object in class method). 我手动释放对象并分析我的应用程序,我只有一个内存泄漏(在类方法中返回对象)。 What was the problem? 出了什么问题? is it harm to app while apple approve it?. 苹果批准它对app有害吗? Please help me. 请帮我。 Thanks in advance. 提前致谢。

No, you really shouldn't release it with this kind of a leak (or memory accretion). 不,你真的不应该用这种泄漏(或记忆增加)释放它。 It will lead to crashes and that will cause data loss and upset users. 它将导致崩溃,这将导致数据丢失并扰乱用户。

Heapshot analysis is designed to track down these kinds of problems. 快照分析旨在追踪这些类型的问题。 That is, use the Allocations Instrument to track memory growth over time iteratively and then eliminate the large memory consumers. 也就是说,使用分配工具迭代地跟踪内存增长,然后消除大量内存消费者。

Apple will probably approve it as long as it is not crashing within the review time. Apple可能会批准它,只要它在审核时间内没有崩溃。

But no you should not release the app if you have a memory leak like this. 但是如果你有像这样的内存泄漏,不应该发布应用程序。 Your app will have poor user experience and might crash if the users device memory runs full. 您的应用将具有较差的用户体验,并且如果用户设备内存已满,则可能会崩溃。 You will get a low app store rating. 您将获得较低的应用商店评级。

I would suggest you find out which object is taking up so much memory and fix it. 我建议你找出哪个对象占用了这么多内存并修复它。 If at all possible switch to ARC, this will take away some leaks. 如果可能切换到ARC,这将消除一些泄漏。

I have same problem too. 我也有同样的问题。 NSZombieEnabled flag work for me. NSZombieEnabled标志为我工作。 I think this might be helpful to cope up with ARC. 我认为这可能有助于应对ARC。 I have followed this link: How do I set up NSZombieEnabled in Xcode 4? 我已经关注此链接: 如何在Xcode 4中设置NSZombieEnabled?

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

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