• 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: NSTask in separate thread is leaking memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask in separate thread is leaking memory


  • Subject: Re: NSTask in separate thread is leaking memory
  • From: "Adam R. Maxwell" <email@hidden>
  • Date: Wed, 04 Feb 2009 06:46:28 -0800


On Feb 4, 2009, at 3:25 PM, Oleg Krupnov wrote:

So the problem is solved for now, but one question still left open for
the future is the following: would it be thread-safe to use NSTask in
the way I originally attempted? If yes, why did it leak? The leak was
reported somewhere inside NSTask internal initialization code. Funny
enough, the leak disappeared if I made one superfluous -release call
on NSTask.

No, the NSTask class itself (at least up to 10.4) should only be used from the main thread, particularly if you're spawning multiple tasks at the same time from different threads. I suspect this is due to a race condition in how it's notified of child exit, and it appears to have changed in 10.5.


I wrote my own subclass to get around this, since a user finally had a reproducible bug report. It's BSD licensed, if anyone's interested: http://bibdesk.svn.sourceforge.net/viewvc/bibdesk/trunk/bibdesk/BDSKTask.m?view=markup

--
Adam

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >NSTask in separate thread is leaking memory (From: Oleg Krupnov <email@hidden>)
 >Re: NSTask in separate thread is leaking memory (From: Ken Thomases <email@hidden>)
 >Re: NSTask in separate thread is leaking memory (From: Oleg Krupnov <email@hidden>)

  • Prev by Date: Re: AquaticPrime Config.php + PayPal Advanced Variables Not Working
  • Next by Date: Re: NSTask in separate thread is leaking memory
  • Previous by thread: Re: NSTask in separate thread is leaking memory
  • Next by thread: Re: NSTask in separate thread is leaking memory
  • Index(es):
    • Date
    • Thread