It seems there's a memory leak in ios 8 when using the NSURLConnection sendAsynchronousRequest:queue:completionHandler:
method.
(You can for example put it in the application:didFinishLaunchingWithOptions:
method of AppDelegate
The following code reproduces the issue.
for(int i = 1;i<5000;i++){
NSURL* url = [NSURL URLWithString:@"https://www.google.fr/images/srpr/logo11w.png"];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url];
[NSURLConnection sendAsynchronousRequest:request queue:[[NSOperationQueue alloc] init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
NSLog(@"%d",i);
}];
}
When executed, the memory keeps growing, and when each request is finished, the RAM is about 200MB.
Note that in ios 7, this does not occure.
Does any body know a fix for this ?