title: NSURLSessionDataTask Memory Leaks
body: <p>I am trying to do simple thing with NSURLSessionDataTask to get some data from server. Previously I was using NSURLConnection to get that data, but wanted to move my code to NSURLSessionDataTask. So here the code </p>
  
  <pre><code> NSString *_urlString = [NSString stringWithFormat:@"%@/integration/admin/token",BaseURL];
  
  NSMutableURLRequest *_request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:_urlString]];
  
  [_request setHTTPMethod:@"POST"];
  [_request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
  
  NSData *_sendingData = [NSJSONSerialization dataWithJSONObject:@{@"username":@"demo", @"password":@"demo123"} options:0 error:NULL];
  
  [_request setHTTPBody:_sendingData];
  
  NSURLSessionConfiguration *_defaultConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
  
  NSURLSession *_session = [NSURLSession sessionWithConfiguration:_defaultConfig delegate:self delegateQueue:[NSOperationQueue mainQueue]];
  
  NSURLSessionDataTask *_dataTask = [_session dataTaskWithRequest:_request completionHandler:^(NSData *_data, NSURLResponse *_response, NSError *_error)
                                     {
                                         if (_error)
                                         {
                                             NSLog(@"Error %@",[_error description]);
                                         }
                                         else
                                         {
                                             NSLog(@"No Error %@",[[NSString alloc] initWithData:_data encoding:NSUTF8StringEncoding]);
                                         }
                                     }];
  
  [_dataTask resume];
  [_session finishTasksAndInvalidate];
  </code></pre>
  
  <p>It works Perfectly, I get output also. But when I run same code in Instrument I get following leaks <a href="http://i.stack.imgur.com/zKPzp.png" rel="nofollow">Instrument Output</a></p>