• 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: File descriptors not freed up without a -closeFile call
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File descriptors not freed up without a -closeFile call


  • Subject: Re: File descriptors not freed up without a -closeFile call
  • From: Ben Haller <email@hidden>
  • Date: Thu, 24 Jun 2010 09:19:54 -0400

On 23-Jun-10, at 9:35 AM, Alastair Houghton wrote:

On 23 Jun 2010, at 11:14, Ben Haller wrote:

3. I added [[pipe fileHandleForWriting] closeFile] and [[pipe fileHandleForReading] closeFile] calls to close the files associated with the pipes when my tasks completed. This change fixed the problem; I no longer run out of file descriptors.

Are you making the classic NSTask mistake of doing [pipe fileHandleForReading] or [pipe fileHandleForWriting] and then using that with -setStandardOutput: or -setStandardInput:?


NSTask is odd in this respect, in that you're supposed to just pass the *NSPipe*, not a file handle derived from it. If you do the latter, IIRC (from the last time I did this, which was ages ago) it may indeed leak file descriptors.

You only need an NSFileHandle where your process is going to actually read or write; they aren't used for passing pipe handles to subprocesses.

A good clarification, but I was already passing the pipes to NSTask.

Ben Haller
McGill University


_______________________________________________

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: 
 >File descriptors not freed up without a -closeFile call (From: Ben Haller <email@hidden>)
 >Re: File descriptors not freed up without a -closeFile call (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: File descriptors not freed up without a -closeFile call
  • Next by Date: Re: closing a sheet from another controller
  • Previous by thread: Re: File descriptors not freed up without a -closeFile call
  • Next by thread: Custom views in navigationbar (iOS 3.2)
  • Index(es):
    • Date
    • Thread