0

我正在尝试在带有 iOS 5.1(启用 ARC)的 Xcode 4 中使用 Memory Leak 工具,并且我发现了内存泄漏,但是我到底是如何到达导致泄漏的代码行的呢?我已经阅读了一些关于此的教程,但它似乎是检测工具的旧版本,因为当我单击扩展详细信息选项卡并双击回溯中的项目时,我只会看到无用的汇编代码。此外,stacktrace 上的所有项目都不是我编写的任何类。我错过了什么吗?

4

1 回答 1

1

If your code leaks memory, you will see your relevant methods in the details tab, right where you are looking. They are displayed in black as opposed to methods in the APIs which are gray. You can't look into API Methods of course, hence the assembly code. If there is really something wrong in your code, set the slider on the bottom of the tab on the rightmost position and you should see the concerned methods.

If still none of them are in your code, you probably just don't leak anything. (There are actually not many scenarios in which ARC-Code can leak memory. Retain cycles are probably the most common one) I stumbles over one or two cases in which an API was 'leaking' memory. There is really nothing you can do about it and most likely, it's just a false positive anyway rather than a real leak. If you are only 'leaking' a few bytes, I wouldn't worry about it.

于 2012-04-29T20:13:56.430 回答