简体   繁体   English

泄漏永远不会在Xcode 6.1.1 Instruments工具中显示

[英]Leaks never show up in Xcode 6.1.1 Instruments tool

Similar to this Q , I'm trying to find leaks in an app that keeps giving memory warnings, but even though I've purposely put in a few leaks as a sanity check like this for ex: 类似于此Q ,我试图在不断发出内存警告的应用程序中查找泄漏,但是即使我故意将一些泄漏作为此类健全性检查,例如:

id someObject = [[NSObject alloc] init];
someObject = nil;

nothing ever shows up in the Leaks section of the Instruments tool when using the Leaks profile with XCode 6.1.1. 在XCode 6.1.1中使用“泄漏”配置文件时,“工具”的“泄漏”部分中什么都不会显示。 I feel like I'm missing something basic to "enable" leak detection. 我觉得我缺少“启用”泄漏检测的基础知识。 Please help! 请帮忙!

Are you using ARC? 您在使用ARC吗? In so, then that's not a leak. 这样,那不是泄漏。

If you are not using ARC, then please note that the static analyzer ("Analyze" on Xcode's "Product" menu) is absolutely brilliant at identifying all sorts of problems. 如果您不使用ARC,则请注意,静态分析器(Xcode的“产品”菜单上的“分析”)在识别各种问题方面非常出色。 It would have immediately identified the issue you reference in your question, bringing it to your attention far more quickly. 它会立即识别出您在问题中引用的问题,从而更快地引起您的注意。 Make sure you have a clean bill of health from the static analyzer. 确保从静态分析仪获得干净的健康单。

But, to your broader question, lots of memory problems (greedy caches, abandoned memory, strong reference cycles, etc.) are not identified by leaks tool. 但是,对于更广泛的问题,泄漏工具无法识别很多内存问题(贪婪的缓存,废弃的内存,强大的参考周期等)。 Use Allocations tool, drag thru portion of graph to select range, and look at the objects allocated but not released. 使用分配工具,拖动图形的一部分以选择范围,然后查看已分配但未释放的对象。 Leaks tool won't identify many of these issues, but Allocations tool will. 泄漏工具无法识别其中许多问题,但是分配工具可以。

See WWDC 2014 video Fixing Memory Problems or WWDC 2013 iOS App Performance: Memory . 请参阅WWDC 2014视频修复内存问题或WWDC 2013 iOS App性能:内存

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

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