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
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: michael.le_barbier@l...
Subject: Re: [Caml-list] Ask for a more efficient way to deallocate memory (full version)
Fabrice Pardo <> writes:

> I have a new question now:
> What is the drawback if we keep hidden
> unsecure external functions (allocating out of the heap
> resources, as Unix.opendir),
> only publishing secure functions as "with_dir" ?
> Of course, I mean other drawback than changing the API.

A drawback is that careful management of these ressources is no more
possible. If the choices made by module designer to ensure security do
not fit well your problem, you are left with no option other than
writing poorly behaving applications.

In contrast, given a module that delegates ressource management to its
users, it is fairly trivial to wrap modules's functionnalitites into a
module that automatizes ressource management in a way that will fit
many uses.

One would write an `EasyLazyUnix', `CookedUnix' or `UnixChest' module
with automatic deallocation of ressources.
Michaël LB