• 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
Re: [SOLVED] Delayed -dealloc occurs on worker thread if object is "working".
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SOLVED] Delayed -dealloc occurs on worker thread if object is "working".


  • Subject: Re: [SOLVED] Delayed -dealloc occurs on worker thread if object is "working".
  • From: Jerry Krinock <email@hidden>
  • Date: Fri, 4 Jun 2010 08:27:26 -0700

On 2010 Jun 02, at 10:48, BJ Homer wrote:

> detachNewThreadSelector:target:withObject: retains both the target and the object.

Thank you, BJ.  That explains everything.

On 2010 Jun 02, at 11:12, Jens Alfke wrote:

> It’s really not a good idea to obsess over the details of when objects get dealloced, unless of course you’re running into dealloced-object crashes or memory leaks.

Actually Jens, I was looking for a memory leak, but now I see that this was caused by a "thread leak".  I had wrapped a kqueue in a target object which runs an infinite loop camping on kevent() in a secondary thread.  Forever.  The fix is, when done with the kqueue, I now close() its file descriptor, which I should do anyhow.  Conveniently, this causes kevent() to return an error, running the loop one last time, because when I detect the error I break out of the loop.  Then the thread ends and, as BJ says, releases the thread's target and object.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: [SOLVED] Delayed -dealloc occurs on worker thread if object is "working".
      • From: Michael Ash <email@hidden>
References: 
 >Delayed -dealloc occurs on worker thread if object is "working". How? (From: Jerry Krinock <email@hidden>)
 >Re: Delayed -dealloc occurs on worker thread if object is "working". How? (From: BJ Homer <email@hidden>)

  • Prev by Date: Class OC_PythonObject: no such selector: _cfTypeID
  • Next by Date: Re: [SOLVED] Delayed -dealloc occurs on worker thread if object is "working".
  • Previous by thread: Re: Delayed -dealloc occurs on worker thread if object is "working". How?
  • Next by thread: Re: [SOLVED] Delayed -dealloc occurs on worker thread if object is "working".
  • Index(es):
    • Date
    • Thread