[Haskell-cafe] Are handles garbage-collected?

Tomasz Zielonka t.zielonka at students.mimuw.edu.pl
Sun Oct 24 04:32:49 EDT 2004

On Sun, Oct 24, 2004 at 01:39:06AM +0200, Peter Simons wrote:
> What happens when a System.IO.Handle falls out of scope
> without being explicitly hClosed? Is that a resource leak?
> Or will the RTS close the handle for me?

AFAIK, Handles have finalisers which close them, but I don't know if GHC
triggers garbage collection when file descriptors run out.  If not, you
will have problems if you manage to run out of fds between GCs.

How about using bracket to introduce explicit close on end of scope?

Best regards,

.signature: Too many levels of symbolic links

More information about the Haskell-Cafe mailing list