Last active
October 12, 2015 14:58
-
-
Save hhartz/4044503 to your computer and use it in GitHub Desktop.
Manual tracking of retain/release and subsequent retainCount
This file contains hidden or 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
- (NSString*) filteredCallstackSymbol | |
{ | |
NSArray *callStackSymbols = [NSThread callStackSymbols]; | |
NSPredicate *filter = [NSPredicate predicateWithFormat:@"self contains 'Stay'"]; // filter for 'ClassPrefix' | |
NSArray *filtered = [callStackSymbols filteredArrayUsingPredicate:filter]; | |
NSString *closestSymbol = [filtered objectAtIndex:(filtered.count>2)? 2 : 1]; | |
return closestSymbol; | |
} | |
-(id) retain | |
{ | |
id ret = [super retain]; | |
NSLog(@"retain: %ld %@", | |
(long)[self retainCount], | |
[self filteredCallstackSymbol]); | |
return ret; | |
} | |
-(oneway void) release | |
{ | |
[super release]; | |
NSLog(@"release: %ld %@", | |
(long)[self retainCount], | |
[self filteredCallstackSymbol]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment