• 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
Strange memory leak with AsyncSocket and multithreading
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange memory leak with AsyncSocket and multithreading


  • Subject: Strange memory leak with AsyncSocket and multithreading
  • From: Martin Redington <email@hidden>
  • Date: Thu, 10 Aug 2006 19:59:10 +0100



I'm having a strange leak with AsyncSocket in secondary threads, but not on the main thread.

I've been using leaks and OmniObjectMeter to debug this.

I've managed to establish that when running under the main thread, an extra ___delayedPerformCleanup is called from the runLoop, and this calls an extra release, and the memory is freed.

In my other threads, all of the other calls match and balance the main thread exactly (obviously the stack traces are slightly different), and I can identify the reason for each of the calls.

However, the ___delayedPerformCleanup call doesn't occur in the sub threads.

This only occurs with sockets that I used to connect to remote nodes. I also have accepting sockets in an independent thread.

The matching retain seems to occur inside

-[NSObject (NSDelayedPerforming) performSelector:withObject:afterDelay]

which is called from inside -[AsyncSocket close], but I can't quite work out exactly which call is responsible for this.

Note that these threads are stopped shortly after the connections close, using [NSThread exit]

Do I need to let the thread live on a little to give it a chance to clean up?






_______________________________________________ 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: Strange memory leak with AsyncSocket and multithreading
      • From: AgentM <email@hidden>
  • Prev by Date: Re: DocumentController - detect source of request to open document?
  • Next by Date: Re: Strange memory leak with AsyncSocket and multithreading
  • Previous by thread: Re: TextView question
  • Next by thread: Re: Strange memory leak with AsyncSocket and multithreading
  • Index(es):
    • Date
    • Thread