Re: File descriptors not freed up without a -closeFile call
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