Last active
May 1, 2017 16:21
-
-
Save julienXX/bb076b0b95c738217b03e14e51f23876 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
//Tried something a bit brutal like to isolate the leak: | |
... | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), | |
^{ | |
__block BOOL notificationStillPresent; | |
NSUInteger notificationsCount = [[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications].count; | |
do { | |
notificationStillPresent = NO; | |
NSUInteger currentCount = [[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications].count; | |
NSLog(@"initial count %lu", (unsigned long)notificationsCount); | |
NSLog(@"current count %lu", (unsigned long)currentCount); | |
if ((unsigned long)currentCount == (unsigned long)notificationsCount) notificationStillPresent = YES; | |
if (notificationStillPresent) [NSThread sleepForTimeInterval:0.20f]; | |
} while (notificationStillPresent); | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
NSDictionary *udict = @{@"activationType" : @"closed", @"activationValue" : userNotification.otherButtonTitle}; | |
[self Quit:udict notification:userNotification]; | |
exit(0); | |
}); | |
}); | |
... | |
//This code is wrong as it closes all notifications but I wanted to try and it's still leaking. |
If I increase the sleeping time, leaking is mitigated but that's not a proper way to fix it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The best I could get memory-wise seems to be as you proposed:
but it's still leaking somewhere.