Browse thread
[Caml-list] GC and file descriptors
-
Dustin Sallings
- David Fox
- Nicolas George
- Mikael Brockman
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Eric Dahlman <edahlman@a...> |
| Subject: | Re: [Caml-list] GC and file descriptors |
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 > the garbage collector? On the contrary, the memory deallocaton always > succeeds. Another problem with doing this is that you are tying the rate at which file descriptors are closed to the GC profile of your program. If you only have 10's or 100's of file descriptors available it would be very easy to use them all up in a tight loop which did not allocate much memory. It would be a bummer to have your program start failing because you used a more memory efficient algorithm for some calculation. -Eric ------------------- 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