From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA19303; Mon, 22 Dec 2003 14:26:29 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA20387 for ; Mon, 22 Dec 2003 14:26:26 +0100 (MET) Received: from aomori.annexia.org (annexia.force9.co.uk [212.56.101.183]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hBMDQLv25202 for ; Mon, 22 Dec 2003 14:26:21 +0100 (MET) Received: from rich by aomori.annexia.org with local (Exim 3.36 #1 (Debian)) id 1AYOTM-0004Gz-00 for ; Mon, 22 Dec 2003 11:43:40 +0000 Date: Mon, 22 Dec 2003 11:43:39 +0000 Cc: caml-list@inria.fr Subject: Re: [Caml-list] [PATCH] Dynamic freeing of dynamically loaded code Message-ID: <20031222114339.GA16395@redhat.com> References: <873cbdqoar.fsf@naked.iki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <873cbdqoar.fsf@naked.iki.fi> User-Agent: Mutt/1.5.4i From: Richard Jones X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 dynamically:01 closures:01 loadfile:01 mli:01 script's:01 freshmeat:01 vectors:01 hashes:01 funcs:01 allocator:01 ltd:98 garbage:01 blah:01 blah:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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. 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