Version française
Home     About     Download     Resources     Contact us    
Browse thread
Ask for a more efficient way to deallocate memory (full version)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Ask for a more efficient way to deallocate memory (full version)
On Sunday 09 December 2007 21:39, Fabrice.Pardo@lpn.cnrs.fr wrote:
> Hello, and sorry for my previous unfinished message.
>
> As the function Unix.opendir returns a value,
> we can expect that Unix.closedir will be automatically
> called when the dir_handle value is no more referenced.

You cannot expect that.

> ...
> My question is how to write a code as efficient
> as it would be possible using a reference-counted language.

RAII wrapped in a higher-order function as Olivier described is the idiomatic 
solution in OCaml.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e