skorulis
skorulis

Reputation: 4381

Non Public NSURLConnection leaks

I'm getting a number of leaks in my app that are caused by using NSURLConnections. The thing is that all the leaks are system objects, not actually the objects I am creating. Things like CFURLConnection, CFURLRequest, URLConnectionInstanceData and HTTPBodyData. But the actual NSURLConnection is not reported as a leak and neither is the NSMutableURLRequest. I'm unable to post all of the code so here's the important information:

  1. The project is non ARC.
  2. The NSURLConnections are created on the main thread.
  3. This is an asynchronous call.
  4. There are multiple NSURLConnections created all using the same delegate.
  5. The call is a HTTP post
  6. Have seen this bug in both 5.0 and 5.1 devices.

I've tried a number of different approaches to refactor the code and stop the problem but I really don't know how to track down the cause of the bug since everything is pointing to system libraries. Has anyone encountered a similar problem or have any ideas how one would go about finding where the problem lies?

Upvotes: 1

Views: 259

Answers (1)

skorulis
skorulis

Reputation: 4381

This problem was caused by a malformed URL. It appears that if you supply an invalid url it causes a leak in CFNetwork.

Upvotes: 1

Related Questions