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 HAA30979; Sat, 13 Dec 2003 07:50:24 +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 HAA30943 for ; Sat, 13 Dec 2003 07:50:23 +0100 (MET) Received: from smtp3.pp.htv.fi (smtp3.pp.htv.fi [213.243.153.173]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hBD6oM116267 for ; Sat, 13 Dec 2003 07:50:22 +0100 (MET) Received: from posti.pp.htv.fi (posti.pp.htv.fi [212.90.64.50]) by smtp3.pp.htv.fi (Postfix) with ESMTP id 0D86A27B5B9; Sat, 13 Dec 2003 08:50:22 +0200 (EET) Received: from oro (aka.pp.htv.fi [213.243.183.115]) by posti.pp.htv.fi (8.11.1 (Revision 1.5+JAGae91741+JAGae92668) /8.11.1) with ESMTP id hBD6oLT08773; Sat, 13 Dec 2003 08:50:21 +0200 (EET) Received: from naked by oro with local (Exim 3.36 #1 (Debian)) id 1AV3bZ-0008Rv-00; Sat, 13 Dec 2003 08:50:21 +0200 To: skaller@ozemail.com.au Cc: Alain.Frisch@ens.fr, Caml list Subject: Re: [Caml-list] Freeing dynamically loaded code References: <1071281096.14110.16.camel@pelican> From: Nuutti Kotivuori Date: Sat, 13 Dec 2003 08:50:19 +0200 In-Reply-To: <1071281096.14110.16.camel@pelican> (skaller@ozemail.com.au's message of "13 Dec 2003 13:04:57 +1100") Message-ID: <87zndx5hzo.fsf@naked.iki.fi> User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 dynamically:01 ozemail:01 subroutine:01 pointers:01 unload:01 cmo:01 ocaml:01 caml:01 referenced:02 collector:02 external:03 module:03 heap:03 heap:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk skaller@ozemail.com.au wrote: > That is not enough. It is not necessary for some code to be > active in order that it may later *become* active as > a result of a subroutine call or jump. It would be necessary > to find all code addresses and which blocks they point to, > and build a dependency graph, and add the roots of that graph > to the gc memory graph as well. > > Otherwise, after you say > > #load xxxx > > the collector would immediately free it :-) Actually no. The way to access code that is not "active" as you say, is through global variables. Eg. if you do #load "test.cmo" then there's an entry Test in the global table that holds pointers for all functions defined in that file. And the global table is inside the ocaml heap, so those all will be referenced. The only way for that to become unloaded is that the global Test is replaced or removed by something - either by some unload module or loading a newer source on top of it - and then no references point to Test. And if no references point to the file, it really cannot be accessed anymore by any means, and hence can be removed. Ofcourse, right now there might be also other external references to the code in the heap, I am not sure - but those would have to be either removed or made Weak somehow. But that is to be solved after this immediate problem is resolved. -- Naked ------------------- 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