Last active
April 14, 2016 20:59
-
-
Save gnachman/88360e91021283d3f7be to your computer and use it in GitHub Desktop.
Retain release debugging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (id)retain { | |
if (_debug) { | |
NSLog(@"retain %@ rc->%d", self, (int)self.retainCount + 1); | |
NSLog(@"%@", [NSThread callStackSymbols]); | |
} | |
return [super retain]; | |
} | |
- (oneway void)release { | |
if (_debug) { | |
NSLog(@"release %@ rc->%d", self, (int)self.retainCount - 1); | |
NSLog(@"%@", [NSThread callStackSymbols]); | |
} | |
[super release]; | |
} | |
- (id)autorelease { | |
if (_debug) { | |
NSLog(@"autorelease %@", self); | |
NSLog(@"%@", [NSThread callStackSymbols]); | |
} | |
return [super autorelease]; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment