Reputation: 331
I am using instruments to resolve memory leak issues for an app in iPhone. I just wanted to know if I have to resolve the leaks coming from Foundation and CFNetwork Libraries. Specifically, the leaks are from:
1. NSCFString
2. NSConcreteData
3. General Block-3584
Since they do not directly point to the code that I have written, how should I resolve them, if I have to?
Thanks.
Upvotes: 0
Views: 5658
Reputation: 11
I experienced the same problems w.r.to memory leaks which were pointing to CFNetwork and Foundation framework. A small fix cleared all the memory leaks. While using aynchronous HTTP connection, I faced this problem.
In the delegate, - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse*)
response,
I copied NSURLResponse and released.
Dont copy and release NSURLResponse. Just use it as property asstype in your header file.
Upvotes: 1
Reputation: 7422
It's almost certain that the memory leaks come from your code--there are almost no memory leaks in the Foundation libraries, providing you're testing on the device (there are memory leaks in the simulator, so you should always test on the device). It's not always immediately obvious where the leak comes from, and it's difficult to tell from your question, but I would guess it either comes from leaking an NSString
(NSStrings
are implemented with NSCFString
under the hood) or a network-related class like NSURLConnection
.
Upvotes: 1