• 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 08:38:45 -0400

On 23-Jun-10, at 8:40 AM, Dave Keck wrote:

Ah, interesting. I missed that in the docs. It still seems bad to me that
the file handle will actually dealloc without closing its associated file
descriptor, but perhaps you are right that that is the documented behavior.
I'll just stop worrying about it and move on, then. Thanks!

NSPipe and its NSFileHandles work as you expect: when the read/write file handles created via NSPipe are deallocated, the underlying descriptors are closed. Along with Jean-Daniel Dupas, I created a simple test case and it behaves as expected. (I've also been using NSPipe/NSFileHandle extensively for years and have never come across anything like you described.)

I'd be interested in seeing a test case showing the incorrect behavior.

Jean-Daniel's test case only used -fileHandleForReading, whereas it seems that only -fileHandleForWriting expects to be closed, according to the doc. Anyhow, I feel pretty certain of the behavior I'm seeing; I triple-checked it before I posted to the list. I have no idea why my code would exhibit this behavior when simple test cases don't, but there it is. Anyhow, it looks like it is not considered a bug according to the docs, so I'm not inclined to pursue it further; even if I got a reproducing case and filed a bug, it sounds like it would get marked not a bug, so it hardly seems worth the effort.


  Thanks anyway!

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: Uli Kusterer <email@hidden>)
 >Re: 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: "email@hidden" <email@hidden>)
 >Re: 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: Dave Keck <email@hidden>)

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