caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <Jacques.Garrigue@inria.fr>
To: skaller@maxtal.com.au
Cc: caml-list@inria.fr
Subject: Re: Finalisation in 2.02
Date: Mon, 13 Dec 1999 10:35:38 +0100	[thread overview]
Message-ID: <19991213103538V.garrigue@pauillac.inria.fr> (raw)
In-Reply-To: Your message of "Sun, 12 Dec 1999 14:38:03 +1100" <3853189B.86E5EBFE@maxtal.com.au>

From: skaller <skaller@maxtal.com.au>

> 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




  reply	other threads:[~1999-12-13 12:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-12  3:38 skaller
1999-12-13  9:35 ` Jacques Garrigue [this message]
1999-12-15  8:41   ` Patrick Goldbronn - SYSCO
1999-12-13 12:50 Damien Doligez
1999-12-23 17:06 Damien Doligez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19991213103538V.garrigue@pauillac.inria.fr \
    --to=jacques.garrigue@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=skaller@maxtal.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).