Here is my code:
- (void)showRectangles
{
NSMutableArray *rects = [[NSMutableArray alloc]init];
//....rest of code here
[rects release];
}
The problem here is that when I analyze the code, it gives me this warning:
Incorrect decrement of the reference count of an object that is not owned at this point by the caller
I don’t understand why this gives me a warning. Can anyone explain why?
by expanding the message in the problem navigator, xcode will point out every ref count op for you. ultimately, this will show you how the static analyzer came to this conclusion.
alternatively, it’s possible you have reassigned the variable
rectsalong the way (introducing a leak and over-release).