RE: aha! file descriptor leak in 'readFile'

20 Apr
2004
20 Apr
'04
5:19 a.m.
On 19 April 2004 08:32, John Meacham wrote:
I have finally tracked down a test case which results in the file descriptor leak which has plauged one of my programs since its birth.
this code: sequence (replicate 100 $ handle (\_ -> return "") ( readFile "."))
will leak 100 file descriptors, apparently, after a Fail: .: openFile: inappropriate type (is a directory) exception from readFile, the file descriptor will not be closed, and instead be left open til the end o' time.
it took me a long time to find because I thought the bug was in the listing of my directories, not the readFile's of its contents (including "." and "..").
Yes, that's a bug. Now fixed. Cheers, Simon
7700
Age (days ago)
7700
Last active (days ago)
0 comments
1 participants
participants (1)
-
Simon Marlow