"Samuel Bronson" <[EMAIL PROTECTED]> wrote: > > Can I just leave it hanging and rely on the garbage collector to > > close it in the fullness of time? > > Actually, hGetContents closes the handle when it gets an EOF. > > If it never does get EOF (because you never use all of the data), the > garbage collector *might* close the handle, but I haven't heard of a > garbage collector that was aware of the value of resources other than RAM
Actually, I'm pretty sure that most Haskell RTS implementations have a finalizer attached to all file handles. Once the file handle is no longer reachable from the program graph (even if its data has not been fully consumed), the GC will close the file (via the finalizer) before reaping the memory associated with the handle. Regards, Malcolm _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell