From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA23830 for caml-redistribution; Sun, 12 Dec 1999 23:06:15 +0100 (MET) 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 EAA08153 for ; Sun, 12 Dec 1999 04:36:51 +0100 (MET) Received: from ruby (ike17.zip.com.au [61.8.10.17]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id EAA08329 for ; Sun, 12 Dec 1999 04:36:43 +0100 (MET) Received: from maxtal.com.au (IDENT:root@localhost [127.0.0.1]) by ruby (8.9.3/8.9.3) with ESMTP id OAA04303 for ; Sun, 12 Dec 1999 14:38:03 +1100 Sender: weis Message-ID: <3853189B.86E5EBFE@maxtal.com.au> Date: Sun, 12 Dec 1999 14:38:03 +1100 From: skaller Organization: Maxtal X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.12 i586) X-Accept-Language: en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Finalisation in 2.02 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I'm still using ocaml 2.02, and have encountered what looks like a bug, although perhaps it is my understanding, and perhaps it is fixed in 2.04, or will be in 3. The problem is that when I create an object with alloc_final(_,_,0,1), the finaliser is not called on termination. Using 1,1 seems to cause it to be called almost immediately. [I seem to also get this behaviour with output to stdout -- I have to flush the file after every write, in case an exception terminates the program, and these debugging writes are there precisely to track this] I'm modifying mlgtk by boxing GtkObjects, this seems necessary to allow the collector to call the finaliser which decrements the reference count -- however, at least the memory of the object doesn't seem to be released when caml terminates. Does 0,1 mean 'never bother calling the finaliser, there is nothing to finalise'? That makes mathematical sense (but isn't what I expected, since the documentation advises to use this setting if you aren't sure). Perhaps I should force a full GC collection, just before termination? BTW: I would like to reinforce comments that ocaml is easy to interface! In fact, it is easier than Python or Tcl (I have extensive experience with both). I don't claim to really understand everything yet -- but I seem to be able to get code working very quickly. -- John Skaller, mailto:skaller@maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia homepage: http://www.maxtal.com.au/~skaller voice: 61-2-9660-0850