Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Max Kirillov <max630@m...>
Subject: Re: [Caml-list] GC and file descriptors
On Fri, Nov 14, 2003 at 11:24:21PM +0300, Dmitry Bely wrote:
> Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr> writes:
> 
>>>>     Garbage collecting the subprocesses and file descriptors would
>>>> make this a bit more straightforward.
>>> The problem with this approach is that the "close" and "wait"
>>> system calls have side effects.  I don't like the idea of a GC
>>> that has side effects other than the memory size of the program
>>> (and finalisation functions, of course).
>>
>> Why ? Could you elaborate ?
> 
> close() can fail (generate an exception). How are you going to handle it in

According to 'man 2 close', it cannot.

Nearly the same is true for any resource deallocation.
The only exception I can recall is wait -- but, when you don't need the
exit status (and you surely don't, once you leave it to GC), you can
ignore all the errors.

Of course here might be a questions wish unflushed data. But still, if
you don't flush the writing channel before finishing a function, you
probably don't need you output to be delivered in any case.

> the garbage collector? On the contrary, the memory deallocaton always
> succeeds.
> - Dmitry Bely
> 
> 
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> 

-- 
Max

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners