xcode 中泄漏仪器的准确性
所以我想知道 xcode 4 中的泄漏工具有多准确。我应该相信它能找到我所有的内存泄漏还是应该做其他事情?
So I am wondering that how accurate the leaks instrument in xcode 4 is. Should I trust it to find my all memory leaks or should I also do something else?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Leaks 专门扫描所有内存并找到任何看起来像指针的东西。如果该类似指针的值指向一个分配,则该分配不会泄漏。
即,这是一种非常保守的扫描,因此通常无法报告有效泄露的内容。
更重要的是,Leaks 无法报告无用的累积内存。也就是说,如果您有一个“只写缓存”,您不断地填充缓存,从不从中读取,并且一路上丢失密钥,那么所有内存都不会泄漏(“它在缓存中,伙计!”) ,但也完全没用。
为此,有Heapshot Analysis。示例用例 我不久前写过。
Leaks specifically scans all of memory and finds anything that looks like a pointer. If that pointer-like value points to an allocation, than that allocation is not leaked.
I.e. it is a very conservative scan and, thus, will often fail to report things which are effectively leaked.
More importantly, Leaks cannot report memory that is uselessly accreted. I.e. if you have a "write only cache" where you are constantly filling the cache, never reading from it, and losing the keys along the way, all that memory will not be leaks ("it is in the cache, man!"), but it is also totally useless.
For that, there is Heapshot Analysis. An example use case of which I wrote up a while ago.