• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSURLConnection leaks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSURLConnection leaks


  • Subject: NSURLConnection leaks
  • From: Steve Palmer <email@hidden>
  • Date: Wed, 22 Jun 2005 08:28:04 -0700

After using NSURLConnection, I'm seeing some leak issues in my code that I can't quite figure out. The specific call is:

                NSURLConnection * theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:handler];

This code is run several times and is balanced by a call to release. After a few hours I'm seeing a huge number of the following reported by the leaks utility:

Leak: 0x05f75e70  size=240    instance of 'NSCFDictionary'   
    0x00402a70 0x00010397 0x00000003 0x00000011     .@*p............
    0x00000017 0xa1b1c1d3 0x00000000 0x00000000     ................
    0x00000000 0x05f75e9c 0x05f75ef8 0xa0eef390     ......^...^.....
    0xa1b1c1d3 0xa1b1c1d3 0xa0eef2e0 0xa1b1c1d3     ................
    0xa0eef330 0xa1b1c1d3 0xa1b1c1d3 0xa1b1c1d3     ...0............
    0xa1b1c1d3 0xa1b1c1d3 0xa1b1c1d3 0xa1b1c1d3     ................
    0xa1b1c1d3 0xa1b1c1d3 0xa1b1c1d3 0xa1b1c1d3     ................
    0xa1b1c1d3 0xa1b1c1d3 0xa1b1c1d3 0xa1b1c1d3     ................
    ...
    Call stack: [thread 9287c2b3]: | 0x0 | _pthread_body | forkThreadForFunction | +[NSURLConnection(NSURLConnectionInternal) _resourceLoadLoop:] | CFRunLoopRunSpecific | __CFRunLoopRun | __CFRunLoopDoSources0 | _resourceLoaderPerform | -[NSURLConnection(NSURLConnectionInternal) _performOriginLoad] | -[NSConnectionHTTPURLProtocol startOriginLoad] | -[NSConnectionHTTPURLProtocol continueBeginLoadInBackgroundAfterCreatingHTTPRequest] | -[NSConnectionHTTPURLProtocol createStream:] | CFHTTPConnectionCreate | _CFNetConnectionCreate | httpConnectionCreateStreams | CFReadStreamCreateHTTPStream | CFHTTPMessageCreateEmpty | _CFHTTPMessageCreate | __CFDictionaryInit | _CFRuntimeCreateInstance | CFAllocatorAllocate 

More interestingly, when I examine [theConnection retainCount] immediately after the previous alloc request, the retain count is set to 2 instead of the expected 1. Consequently I'm also seeing a huge number of reports by leaks that the NSURLConnection object isn't being released.

Is the reported leak familiar to anybody and do they have any idea of the cause? And is there an explanation why NSURLConnection:initWithRequest:delegate is returning an object with a retain count of 2. Is the OS somehow caching requests for reuse?

- Steve

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSURLConnection leaks
      • From: Steve Palmer <email@hidden>
  • Prev by Date: Bringing up an "Open With" dialog from the finder.
  • Next by Date: Re: Problem with protocols using gcc 4
  • Previous by thread: Bringing up an "Open With" dialog from the finder.
  • Next by thread: Re: NSURLConnection leaks
  • Index(es):
    • Date
    • Thread