I just ran the clang static analyzer on my project, and I am receiving the following warning:
Incorrect decrement of the reference count of an object that is not owned at this point by the caller
Please can you tell me what my problem is. I usually am able manage the memory used in my app very well.
self.cupboardViewController = [[CupboardViewController alloc] initWithNibName:@"CupboardViewController" bundle:[NSBundle mainBundle]];
[self.window addSubview:self.cupboardViewController.view];
- (void)dealloc {
[[self cupboardViewController] release];//where I am getting the warning.
[super dealloc];
}
cupboardViewControlleris markedretain, you're going to leak it regardless, because it'll automatically retain the new object you create in the first line of your example. You should autorelease that object before assigning it to the property, à laself.cupboardViewController = [[[CupboardViewController alloc] init...] autorelease];. - Jonathan Grynspan