Subject: Re: Finalisation in 2.02
In-Reply-To: Your message of "Sun, 12 Dec 1999 14:38:03 +1100"
Date: Mon, 13 Dec 1999 10:35:38 +0100
From: Jacques Garrigue <Jacques.Garrigue@inria.fr>
From: skaller <firstname.lastname@example.org>
> 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
(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
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.
Jacques Garrigue, visiting INRIA from Kyoto University
Jacques.Garrigue at inria.fr
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:29 MET