<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/12/a1e760bad5a0db0e02d9b5fc58863254"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-12-22T13:26:29"
  subject="Re: [Caml-list] [PATCH] Dynamic freeing of dynamically loaded code"
  prev="2003/12/a9e3f6e03bb89f6e730fd5401e17d50f"
  next="2003/12/e522814874d2e94650503cf689c10feb"
  prev-in-thread="2003/12/fa15b016f5aca839378d070acde35693"
  next-in-thread="2003/12/d179ea7b8b9fb882777f10e52599a4b4"
  prev-thread="2003/12/c9bf9f5d4423a9259f12ccc805fe4c1d"
  next-thread="2003/12/614e3d3055a840b950a60886e8698ab8"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] [PATCH] Dynamic freeing of dynamically loaded code">
<msg 
  url="2003/12/fa15b016f5aca839378d070acde35693"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-22T08:52:43"
  subject="[Caml-list] [PATCH] Dynamic freeing of dynamically loaded code">
<msg 
  url="2003/12/a1e760bad5a0db0e02d9b5fc58863254"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-12-22T13:26:29"
  subject="Re: [Caml-list] [PATCH] Dynamic freeing of dynamically loaded code">
<msg 
  url="2003/12/d179ea7b8b9fb882777f10e52599a4b4"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-22T17:04:09"
  subject="Re: [Caml-list] [PATCH] Dynamic freeing of dynamically loaded code">
</msg>
</msg>
</msg>
</thread>

<contents>
On Mon, Dec 22, 2003 at 09:55:40AM +0200, Nuutti Kotivuori wrote:
&gt;  - If the module defines any toplevel functions, it cannot ever be
&gt;  freed, because the closures are referenced from the global
&gt;  table. This is true even for loadfile_private. Eg. code that defines
&gt;  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.

Rich.

-- 
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

</contents>

</message>

