Re: NSTask objectalloc problem
Re: NSTask objectalloc problem
- Subject: Re: NSTask objectalloc problem
- From: Jens Alfke <email@hidden>
- Date: Thu, 29 Apr 2010 09:18:49 -0700
On Apr 28, 2010, at 11:16 AM, Tom Foutz wrote:
I am trying to run a back-up type of unix script whenever a file
changes in the directory. However, my implementation, when viewed in
"Instruments" with "ObjectAlloc", demonstrates an ever-increasing
number of living objects.
Isn't that because you're spawning new NSTasks in a tight loop,
probably faster than they can complete? This type of situation is
sometimes used as an attack called a "fork bomb" :)
Your problem might be that you're expecting -[NSTask launch] to be
synchronous, i.e. wait for the task to complete. It isn't. If you want
to block, you should call -waitUntilExit; although usually it's better
to take advantage of NSTask's asynchronous nature and avoid clogging
up your app's UI.
—Jens_______________________________________________
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