Reputation: 1407
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:
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. I feel like I'm missing something basic to "enable" leak detection. Please help!
Upvotes: 0
Views: 388
Reputation: 438202
Are you using 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. 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.
Upvotes: 2