NSURLConnection and NSData leaking memory
So I was wondering if this was a common problem to be leaking memory using NSData to store a connection reponse data. For example, I have this line to initialize my data object
davData = [[NSMutableData data] retain];
And then when the connection errors or finishes loading, I release it. From my understanding, that should not be a leak correct? For so开发者_如何学运维me reason, the data is still showing up in instruments even after I release it. Any idea what could be causing this? Thanks!
Try initializing it like this:
davData = [[NSMutableData alloc] init];
The way you are doing it does not really create a leak, but it is dependent on your object being autoreleased by the system which is probably why you still see it.
精彩评论