Objective-c for the iphone: Mystery memory leak

Posted by user200341 on Stack Overflow See other posts from Stack Overflow or by user200341
Published on 2010-05-26T12:07:34Z Indexed on 2010/05/26 12:11 UTC
Read the original article Hit count: 216

My application seems to have 4 memory leaks (on the device, running instruments).

The memory leaks seems to come from this code:

    NSURL *url = [self getUrl:destination];
[destination release];

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
[url release];

[request setHTTPMethod:@"GET"];
[request addValue:@"application/json" forHTTPHeaderField:@"content-type"];
NSURLConnection *connection = [[NSURLConnection alloc]initWithRequest:request delegate:self];
[request release];

[connection release];

I am releasing all my objects as far as I can see but it's still showing this as the source of the 4 memory leaks.

This is on the Device running 3.1.3

Is it acceptable to have a few memory leaks in your app or do they all have to go?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c