开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜