I have this retained property declared like this:
@property (nonatomic, retain) NSMutableDictionary *codes;
then I synthesize this:
I use the property like this:
self.codes = [NSMutableDictionary dictionary];
Then, I forget to say
[codes release]; in my
When I run Analyzer in XCode 4.3.2, this is not shown as an issue. My base SDK is iOS 5.1 and my compiler is Apple LLVM compiler 3.1
Why doesn't analyzer pick this up?Answer1:
I imagine it's because the analyzer can't reliably detect retain/release issues across method/library boundaries.
You could conceivably pass ownership of your
codes array to some external method or library which will release it later on for you. This would be bad practice because the receiving method should just retain it if it needs it, but I've seen this kind of thing done by inexperienced developers.
So you might see this in your class somewhere:
The analyzer has no way to know that your class is no longer responsible for releasing the array. To give you a warning would be incorrect, despite the fact that you are not following good memory management practices.
The analyzer is very good at only warning on real issues. I don't think I've ever seen a false-positive outside of betas builds, which is a good thing.Answer2:
If you havent change anything from the configuration, whenver you target ios5+ you will automatically be using ARC (Automatic Reference Counting) which doesnt require you to release or retain.<blockquote>
The most disruptive change in iOS 5 is the addition of Automatic Reference Counting, or ARC for short. ARC is a feature of the new LLVM 3.0 compiler and it completely does away with the manual memory management that all iOS developers love to hate.</blockquote>
<em>This is a post by iOS Tutorial Team member Matthijs Hollemans, an experienced iOS developer and designer.</em>