xCode Instruments检测到这些内存泄漏对象是什么? [英] What are these memory leaking objects, detected by xCode Instruments?

查看:153
本文介绍了xCode Instruments检测到这些内存泄漏对象是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iPhone应用程序,似乎有内存泄漏问题.这是一款益智游戏,经过几次困惑后,该应用程序在设备上崩溃了.

I have an iPhone app, that seems to have memory leaking problem. It's a puzzle game, after a few puzzles, the app crashes on devices.

我现在正在尝试使用xcode Instruments来检测正在发生的事情.第一次使用乐器.

I'm now trying to use xcode Instruments to detect what's going on. First time to use Instruments.

我注意到泄漏"图中的一个泄漏条,恰好是在加载视图时.我在下面复制了泄漏的对象.

I noticed a leak bar in the "Leaks" plot, right the time when the view is loaded. I copied the leaked objects below.

Leaked Object   #   Address Size    Responsible Library Responsible Frame
__NSTimeZone    1   0x1f87cfc0  32 Bytes    CFNetwork   _CFGregorianDateCreateWithBytes
icu::OlsonTimeZone  1   0x1f1a9a00  1.00 KB CFNetwork   PACEntryStreamCallback(__CoreReadStream*, unsigned long, void*)
icu::OlsonTimeZone  1   0x1f881850  128 Bytes   CFNetwork   PACEntryStreamCallback(__CoreReadStream*, unsigned long, void*)
icu::OlsonTimeZone  1   0x1f8817d0  128 Bytes   CFNetwork   PACEntryStreamCallback(__CoreReadStream*, unsigned long, void*)
icu::OlsonTimeZone  1   0x1f1a7a00  1.00 KB CFNetwork   PACEntryStreamCallback(__CoreReadStream*, unsigned long, void*)
__NSTimeZone    1   0x1f87d010  32 Bytes    CFNetwork   _CFGregorianDateCreateWithBytes

我的应用继续运行,没有发现其他泄漏的对象.经过几轮困惑之后,它崩溃了.我不确定这与上面显示的泄漏对象有关.我的猜测还有其他问题,但是我认为我需要首先解决这些泄漏的对象.

My app continues to work, with no additional leaked objects found. After a few round of puzzles, it crashed. I'm not sure it's related to the leaked objects shown above. My guess is there are other problem, but I think I need solve these leaked objects first.

在我看来,泄漏的对象与日期/时间有关.我试图注释掉与日期/时间相关的行,但仍然有相同的泄漏对象.有人知道我还应该检查其他什么东西吗? TIA!

Looks to me, the leaked objects are date/time related. I tried to commented out date/time related lines, but I still got the same leaked objects. Anybody knows what other stuff I should check what these leaked objects are? TIA!

推荐答案

只需忽略所有不属于您的应用程序的泄漏.仪器和IOS/框架都不是完美的.您应该只关注在您自己的类中发现的这种泄漏.要发现应用程序中内存问题的根源:

Just ignore all leaks which do not belong to your applications. Neither Instruments nor IOS / frameworks is not perfect. You should focus only on this leaks which are discovered in your own classes. To discover source of memory issues in application:

1)在模式编辑器中启用NSZombieEnabled模式-在这种情况下,仪器将提供更多信息.

1) Enable NSZombieEnabled mode in Schema editor --in this case Instruments will be more informative.

2)使用Xcode中的产品"->分析"工具-Xcode将向您显示源代码中的可疑位置.

2) Use Product->Analyze facility in Xcode -- Xcode will show to you suspected places in the source code.

这篇关于xCode Instruments检测到这些内存泄漏对象是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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