Skip to content

Instantly share code, notes, and snippets.

@quentinfasquel
Last active March 17, 2019 16:55
Show Gist options
  • Save quentinfasquel/fd21fce61bdfe750ef1500e7cc1534fb to your computer and use it in GitHub Desktop.
Save quentinfasquel/fd21fce61bdfe750ef1500e7cc1534fb to your computer and use it in GitHub Desktop.
#import "LeakTest.h"
#import "FailingObject.h"
@interface LeakTest ()
@property (nonatomic, strong) FailingObject *object;
@end
@implementation LeakTest
- (void)performFailure {
_object = [[FailingObject alloc] init];
@try {
[self.object doFail];
// [_object doFail]; // This would not leak `object`.
} @catch (NSException *exception) {
NSLog(@"Caught excepetion: %@", exception.description);
} @finally {
NSLog(@"finally");
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment