Memory leak?
Created by: rgurzhiy
I've made a simple OSX application:
AppDelegate.m
#import "AppDelegate.h"
#import <Bolts/Bolts.h>
@interface AppDelegate ()
@property (weak) IBOutlet NSWindow *window;
@end
@implementation AppDelegate
- (IBAction) test:(id)sender {
[[self testAsync] continueWithBlock:^id (BFTask *task) {
NSLog(@"%@", task.result);
return nil;
}];
}
- (BFTask *) testAsync {
BFTaskCompletionSource *completionSource = [BFTaskCompletionSource taskCompletionSource];
[[BFTask taskWithDelay:1000] continueWithBlock:^id (BFTask *task) {
[completionSource setResult:[NSDate date]];
return nil;
}];
return completionSource.task;
}
@end
When I run it with Allocations instrument, I get the trace BoltsMemory.trace.zip
Almost every time - (IBAction) test:(id)sender
is being executed new allocations are added to the trace and stay Live
forever.
As you can see responsible caller is -[BFTask trySetResult:]
or -[BFTask continueWithExecutor:block:cancellationToken:]
Can it be considered as memory leak?