Skip to content

Instantly share code, notes, and snippets.

@piaoapiao
Created October 16, 2012 07:51
Show Gist options
  • Save piaoapiao/3897886 to your computer and use it in GitHub Desktop.
Save piaoapiao/3897886 to your computer and use it in GitHub Desktop.
leak example
NSURL *tempURL = [[NSURL alloc] initWithString:hotelImage];
self.hotelImg = tempURL;
TT_RELEASE_SAFELY(tempURL);
// self.hotelImg = [NSURL URLWithString:hotelImage];
找到原因了,大伙看代码。。。。,正确的dealloc方法,却碰到这样蛋疼的写法。。。 感觉是过度防卫,。。。
- (void)setImageURL:(NSURL *)aURL
{
if (aURL == nil) {
return;
}
......
}
- (void)dealloc {
self.imageURL = nil;
[super dealloc];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment