Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] GC and file descriptors
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-11-14 (20:49)
From: Brian Hurt <bhurt@s...>
Subject: Re: [Caml-list] GC and file descriptors
On Fri, 14 Nov 2003, Dmitry Bely wrote:

> close() can fail (generate an exception). How are you going to handle it in
> the garbage collector? On the contrary, the memory deallocaton always
> succeeds.

Two choices: either abort the whole program (uncaught exception), or 
ignore it.  Ocaml's life is a little easier, as GC takes place inside the 
single thread of execution.  But I dislike making the language spec 
require that.  

Now, *which* of those two choices is "correct" is a matter for some 
debate.  Myself, I like aborting the whole program.

What I dislike is resource leaks- as plugging the holes manually can often
be tricky.  If I wanted to hand-manage resource deallocation, I'd be
programming in C (well, not quite- but the point is made).

"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
                                - Gene Spafford 

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: