Created
April 7, 2025 15:30
-
-
Save pookjw/6fa8809965db1228981f30911c2dc2bc to your computer and use it in GitHub Desktop.
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
#import <Foundation/Foundation.h> | |
@interface Error : NSError | |
@end | |
@implementation Error | |
+ (BOOL)occurError:(NSError **)error { | |
*error = [[Error alloc] initWithDomain:NSCocoaErrorDomain code:0 userInfo:nil]; | |
return NO; | |
} | |
- (void)dealloc { | |
NSLog(@"%s", __func__); | |
} | |
@end | |
int main(int argc, const char * argv[]) { | |
@autoreleasepool { | |
NSError * _Nullable error = nil; | |
for (NSUInteger i = 0; i < 100; i++) @autoreleasepool { | |
[Error occurError:&error]; | |
} | |
NSLog(@"%@", error); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment