On Thu, Feb 12, 2009 at 21:14:52 +0100, Petr Rockai wrote: > The problem with Prelude readFile is that it's based on hGetContents, which is > lazy by definition. This also means that unless you force consumption of the > produced list, it will keep an fd open for the file, possibly > indefinitely. This is called a fd leak. Other than being annoying and if done > often, leading to fd exhaustion and failure to open any new files (which is > usually fatal), it also prevents the file to be unlinked (deleted) on win32. > > On the other hand, *strict* bytestring version of readFile will read the whole > file into a contiguous buffer, *close the fd* and return. This is perfectly > safe with regards to fd leaks. Btw., this is *not* the case with lazy > bytestring variant of readFile, so that one is unsafe.
Oh, so Simon's suggestion really is the right thing to do then? Ok, I'll apply the patch, thanks! PS: > Let me explain then. In return, I'd be grateful if you could file this > somewhere where people find it the next time this comes around. Excellent request for increasing darcs hacking efficiency. I'll put these into the comments of haskell_policy because I figure that's a reasonable place to look when it complains. -- Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow> PGP Key ID: 08AC04F9
signature.asc
Description: Digital signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
