Are handles closed automatically when they fall out of scope?

I know it's a rather mundane question, but I couldn't find an answer to it! So what does happen when I forget to hClose a Handle? Will the garbage collector do that for me? Or not? And more specifically, what about the handles runInteractiveProcess returns? Do I have to close the "stdin" Handle? All of them? What happens when I use terminateProcess? Do I have to hClose them nonetheless? And while I am at it: How about Socket? Do I have to sClose a socket I obtained from listenOn or accept? Any definite answers would be highly appreciated. Peter

On 2004-10-22, Peter Simons
I know it's a rather mundane question, but I couldn't find an answer to it!
So what does happen when I forget to hClose a Handle? Will the garbage collector do that for me? Or not?
I'd like the answer to this question, too, but also: * Does the same hold true for sockets? * For sockets that also exist as Handles? * What happens when one Handle corresponding to a socket is closed, but another isn't? * What happens when one gets GC'd but another doesn't?
And while I am at it: How about Socket? Do I have to sClose a socket I obtained from listenOn or accept?
Ah. I already asked some of this :-)
participants (2)
-
John Goerzen
-
Peter Simons