> Mon, 11 Sep 2000 02:10:59 -0700, Simon Marlow
> <[EMAIL PROTECTED]> pisze:
>
> > > xs <- mapM readFile (take 1000 (repeat "tmp"));
>
> > That looks reasonable - there's usually some kind of limit on the
> > number of files a process may have open, for example it's 1024 on
> > our Linux box, and 64 on our Sparc box.
>
> It's easier to explain than to fix. readFile's laziness strikes again.
>
> This has bitten be once and caused a major redesign. OK, redesign to
> a better solution, but it should not be forced that way :-)
>
> The Haskell's runtime could do something with it: detect the "too many
> open files" error and try to suck some lazily read files.
I suppose it could try doing a full GC to detect the dead handles, then
somehow arrange that the finalizers all run before anything else. This
sounds fairly complicated though.
I'm of the opinion that readFile/hGetContents are useful for small programs,
but for larger tasks you need to manage your I/O more explicitly.
Cheers,
Simon