English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] [PATCH] Dynamic freeing of dynamically loaded code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-12-22 (13:26)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] [PATCH] Dynamic freeing of dynamically loaded code
On Mon, Dec 22, 2003 at 09:55:40AM +0200, Nuutti Kotivuori wrote:
>  - If the module defines any toplevel functions, it cannot ever be
>  freed, because the closures are referenced from the global
>  table. This is true even for loadfile_private. Eg. code that defines
>  functions will still not be garbage collected.

Does this apply to:

let () = ...

code?  I assume these aren't really "toplevel functions".

More seriously, what about toplevel functions which aren't referenced
outside the code (they may even be made private using an .mli file).
I have a LOT of code which does this sort of thing:

let run r =
  let q = new cgi r in

  (* ... blah blah the CGI script ... *)

(* Register the script's run function. *)
let () =
  register_script run

The toplevel 'run' function is there, but never referenced directly
from outside the code, although of course it is called from outside
the code.


Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
C2LIB is a library of basic Perl/STL-like types for C. Vectors, hashes,
trees, string funcs, pool allocator: http://www.annexia.org/freeware/c2lib/

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