xcode 如何在 ARC 下的 Instruments 中激活 Cycles 报告?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8852451/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to activate Cycles reporting in Instruments under ARC?
提问by Proud Member
Instruments can visualize retain cycles under ARC in a graphically interesting way. I also remember that a few days ago I spotted the "Cycles" view in Instruments by accident.
Instruments 可以以有趣的图形方式可视化 ARC 下的保留周期。我还记得几天前我偶然发现了 Instruments 中的“Cycles”视图。
Now where I started using ARC, suddenly I'm not able to find that anymore. The Allocations and VM Tracker instruments don't offer it, and the Leaks instrument either.
现在我开始使用 ARC,突然间我再也找不到它了。Allocations 和 VM Tracker 工具不提供它,Leaks 工具也不提供。
What must I do in order to see retain cycles?
我必须做什么才能看到保留周期?
Found a screenshot as evidence:
找到截图作为证据:
采纳答案by Aaron Hayman
Using Xcode 4.2.1, I found the it in "Leaks", under "Cycles & Roots". However, I've found it less than useful when using ARC. It does detect CF leaks and apparently I'm leaking a recursive block, which I can't do anything about, but I've had to root out several retain cycles that Leaks never found. For finding retain cycles, I recommend using "Allocations" and running several heap shots between performing the action you suspect of 'leaking'. You then then look through the interim heap shots to find the culprit.
使用 Xcode 4.2.1,我在“泄漏”中的“循环和根”下找到了它。但是,我发现它在使用 ARC 时不太有用。它确实检测到 CF 泄漏,显然我正在泄漏一个递归块,对此我无能为力,但我不得不根除 Leaks 从未发现的几个保留周期。为了找到保留周期,我建议使用“分配”并在执行您怀疑“泄漏”的操作之间运行几次堆快照。然后,您可以查看临时堆快照以找到罪魁祸首。