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 NAA00870 for caml-redistribution; Mon, 13 Dec 1999 13:13:21 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA16794 for ; Mon, 13 Dec 1999 10:35:48 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id KAA27253; Mon, 13 Dec 1999 10:35:39 +0100 (MET) Received: from localhost (riesling.inria.fr [128.93.8.51]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA05322; Mon, 13 Dec 1999 10:35:38 +0100 (MET) To: skaller@maxtal.com.au Cc: caml-list@inria.fr Subject: Re: Finalisation in 2.02 Reply-To: Jacques.Garrigue@inria.fr In-Reply-To: Your message of "Sun, 12 Dec 1999 14:38:03 +1100" <3853189B.86E5EBFE@maxtal.com.au> References: <3853189B.86E5EBFE@maxtal.com.au> X-Mailer: Mew version 1.93 on Emacs 20.4 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <19991213103538V.garrigue@pauillac.inria.fr> Date: Mon, 13 Dec 1999 10:35:38 +0100 From: Jacques Garrigue X-Dispatcher: imput version 980905(IM100) Sender: weis From: skaller > 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. The meaning of the two last parameters is a fraction giving the maximum number of times allocation may be done before GC is called. 0/1 means that the GC urgency count is not incremented, so this may take an indefinite time. 1/1 means do GC on each allocation. As an example, in LablGtk all widgets allocations are finalized, with a parameter 1/200. That is, the GC will be called at least every 200 times I build a pointer to a GtkObject, so that I may not have more than 200 stall pointers. This may need some more tuning, but the number of pointers you create depends very much on your application. If you want to try it on mlgtk, I suggest you have a look at how it is done in LablGtk, since it seems to work ok, and this kind of things (interaction between normal GC and reference counting GC) may be bug-prone. (You may also choose to switch to lablgtk, since it will work on the next version of ocaml :-) > Perhaps I should force a full GC collection, just before > termination? I don't think you need to do it. Reference counting is just to deallocate unused resources in long running programs, it does not change anything in your interaction with the program. Regards, Jacques ------------------------------------------------------ Jacques Garrigue, visiting INRIA from Kyoto University Jacques.Garrigue at inria.fr