So I am wondering that how accu开发者_如何学Gorate the leaks instrument in xcode 4 is. Should I trust it to find my all memory leaks or should I also do something else?
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.
精彩评论