Xcode 中的内存泄漏分析器 - 它的可靠性如何?
我尝试过在 xCode 中使用内存分析器。
它将许多对象标记为泄漏对象,但是当我打开该对象的历史记录时,对该对象的最后一个操作是将对象引用的计数设置为零的释放。
该工具显示的结果有多可靠?它们是潜在的内存泄漏还是已确认的内存泄漏?
如果这肯定是内存泄漏,为什么当我最后一个引用计数为零时会发生这种情况?我配置 xCode 的分析器的方式是否有问题(我只需按 cmd + i)? 贾米尔
I have tried using the memory profiler in xCode.
It flags a number of objects as leaked object but when I open the history of the object, the last operation on that object is a release that sets the object reference's count to zero.
How reliable is the results shown in that tool ? are they potential memory leaks or confirmed ones ?
And if it is definitely a memory leak why is it happening when I have the last reference count is zero ? could it be something wrong in the way I am configuring xCode's profiler (I just press cmd + i)?
Jamil
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您要求分配工具跟踪保留和释放,则分配工具是完全准确的:它会正确跟踪它们。它还正确报告了先前历史中存在的对象数量与现在存在的对象数量之间的差异。
泄漏工具并不总是准确的:例如,根据我的经验,它经常错过泄漏(我从未听说过它报告误报,但我认为这是可能的)。不过,请记住留出足够的时间,因为默认情况下泄漏工具仅每 10 秒进行一次测试。另外,使用堆快照来磨练对象的生命周期。
The allocations tool is perfectly accurate if you have asked it to track retains and releases: it tracks them correctly. It also reports correctly the difference between how many of an object have existed during the previous history and how many exist right now.
The leaks tool is not always accurate: for example, in my experience it often misses leaks (I've never heard of its reporting a false positive but I suppose it's possible). Remember to allow enough time, though, since by default the leaks tool only takes a shot every 10 seconds. Also, use heapshots to hone in on the lifetime of objects.
啊我发现错误了!
我没有在这些实例的类的 dealloc 中调用 [super deallco]
Ah I found the mistake !
I wasn't calling [super deallco] in the dealloc of the class of these instances