I have an older app that does not use ARC. When trying to address a rather simple change, I got stuck on an annoying problem:
When running this:
NSMutableArray *arr=[[NSMutableArray alloc] initWithCapacity:0];
NSLog(@"arr=%08lx", (unsigned long)arr);
[arr release];
I get this in console:
arr=06a2ca50
*** -[__NSArrayM class]: message sent to deallocated instance 0x6a2ca50
The error comes immediately after single stepping over the release statement.
As I don’t recall seeing this before upgrading to 4.4.1, is there anything new in xcode 4.4.1 that explains the above?
Or am I just overseeing something very obvious in the above code?
Update: after downgrading to 4.3.3 the problem disappeared. Currently looking for what might be causing this. I couldn’t reproduce with a new/clean project.
Same problem with xcode 45-DP4 / iOS6..
The project file had NSZombieEnabled=YES in the environment variables of the debug scheme.
I’m not sure why this warning occurs under 4.4.1+ with NSZombieEnabled=YES since none of the standard analyze and diagnostic tools report memory issues.
If anyone has more insight as to why this warning occurs on 4.1.1+, I’m eager to learn. In general I’m keen in taking a compiler or debug warning serious and don’t see disabling them as the best option..