caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Channels not closed on gc?
@ 2012-05-21 11:23 Lauri Alanko
  2012-05-21 11:57 ` AW: " Gerd Stolpmann
  0 siblings, 1 reply; 12+ messages in thread
From: Lauri Alanko @ 2012-05-21 11:23 UTC (permalink / raw)
  To: caml-list

I only recently noticed that ocaml does not close open channels when  
they are garbage collected. This is evidently intentional behavior,  
but it was quite unexpected.

To be clear, I do think it's bad style to rely on GC for releasing OS  
resources, but that doesn't explain why GC shouldn't do this if the  
programmer has failed to explicitly close the channel. And if the  
intention were to _enforce_ good style, the channel finaliser would  
spout out an error or warning upon detecting that the channel hasn't  
yet been closed, instead of just silently leaking file handles like it  
does currently.

It is of course trivial to "fix" this by attaching a simple finaliser,  
but the fact that this is not done by default makes me suspect that  
there would be something fishy with this approach. So, what's the  
rationale for the current behavior?

Thanks,


Lauri



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-05-29 18:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21 11:23 [Caml-list] Channels not closed on gc? Lauri Alanko
2012-05-21 11:57 ` AW: " Gerd Stolpmann
2012-05-21 12:53   ` Philippe Wang
2012-05-21 13:31     ` Gerd Stolpmann
2012-05-21 14:18       ` Philippe Wang
2012-05-21 14:48         ` Mehdi Dogguy
2012-05-29 12:08   ` AW: " Goswin von Brederlow
2012-05-29 12:46     ` Gerd Stolpmann
2012-05-29 14:13       ` oliver
2012-05-29 18:39         ` Török Edwin
2012-05-29 18:58           ` Philippe Veber
2012-05-29 12:49     ` Jérémie Dimino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).