Cup *cup = [[Cup alloc] init]; |
@try { |
[cup fill]; |
} |
@catch (NSException *exception) { |
NSLog(@"main: Caught %@: %@", [exception name], [exception reason]); |
} |
@finally { |
[cup release]; |
} |
Lets assume that [cup fill] throws the exception and its caught here. Isn't the fact that the exception is never released a memory leak? I know I'm being picky but I really see this in a lot of tutorials. I would think that in the catch block I should see [exception release]. Cocoa programmers let me have it.
1 comment:
I was curious myself, so I googled "cocoa exception leak", and found this:
"Exceptions are effectively out-of-band return values; in Cocoa, this means the exception object itself is autoreleased."
Full details here:
http://chanson.livejournal.com/126035.html
Post a Comment