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 RAA13338; Sat, 5 Jun 2004 17:33:22 +0200 (MET DST) 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 RAA13321 for ; Sat, 5 Jun 2004 17:33:21 +0200 (MET DST) Received: from smtp0.libero.it (smtp0.libero.it [193.70.192.33]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i55FXKEV030456 for ; Sat, 5 Jun 2004 17:33:20 +0200 Received: from zoltan.unisuv.it (151.27.30.90) by smtp0.libero.it (7.0.027-DD01) id 40B4BDD400252377; Sat, 5 Jun 2004 17:33:19 +0200 Received: from cs.unipr.it (localhost.localdomain [127.0.0.1]) by zoltan.unisuv.it (8.12.8/8.12.8) with ESMTP id i55FaTbi022479; Sat, 5 Jun 2004 17:36:30 +0200 Message-ID: <40C1E87D.9030903@cs.unipr.it> Date: Sat, 05 Jun 2004 17:36:29 +0200 From: Roberto Bagnara Organization: Department of Mathematics, University of Parma, Italy User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040116 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] Garbage collecting _everything_ Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 40C1E7C0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; struct:01 alloc:01 finalization:01 valgrind:01 valgrind:01 kde:01 finalization:01 beginners:01 invoke:01 ocaml:01 ocaml:01 garbage:01 interfaces:01 leaks:02 objects:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Dear all, we have written a small OCaml program that interfaces to some C++ code. For all the classes we have interfaced, we have defined the required `struct custom_operations' that is then registered with `register_custom_operations()' and referred to in calls to `alloc_custom()'. The finalization functions invoke `delete' on the pointer embedded into the OCaml value. We do this with 6 different C++ classes that are all handled in exactly the same way. Then we have a small test program written in OCaml whose last line is at_exit Gc.full_major;; and for which valgrind (http://valgrind.kde.org/) says we have memory leaks. We have then verified that the finalization functions for 2 of the created C++ objects are never called. As we are really beginners at OCaml programming, we are sure we are missing something, but we don't know what. Isn't `at_exit Gc.full_major;;' supposed to collect _everything_ at program termination time? Thanks in advane for your advice, Roberto -- Prof. Roberto Bagnara Computer Science Group Department of Mathematics, University of Parma, Italy http://www.cs.unipr.it/~bagnara/ mailto:bagnara@cs.unipr.it ------------------- 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