caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques GARRIGUE <garrigue@math.nagoya-u.ac.jp>
To: shiv@ece.ucsb.edu
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Stopping and continuing GC
Date: Sat, 18 Aug 2007 09:07:27 +0900 (JST)	[thread overview]
Message-ID: <20070818.090727.2004170775.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <B59A0D7C-FFE1-4393-A5BA-80EBD934A538@ece.ucsb.edu>

From: Shivkumar Chandrasekaran <shiv@ece.ucsb.edu>

> When I first read it I thought I got it... If I read you correctly,  
> you are saying that lablGTK has tuned off compaction (somehow), but  
> if I manually call Gc.major I can have it done. But, you also say  
> that Gc itself is not turned off. But, I thought Gc.major was an  
> intrinsic part of the gc cycle. Which would imply that compaction  
> would be called anyway, even if I did not call Gc.major explicitly.  
> Are you saying that the "major sweeps" (whatever Gc.major does) are  
> also turned off....
> 
> OTOH, the manual says:
> 
> > If max_overhead >= 1000000, compaction is never triggered.
> 
> If lablGTK has set this, then presumably calling Gc.major will have  
> no impact.
> 
> Thanks for any clarifications.

You're right. I got confused when reading the code.
Since the overhead is raised, you have to call Gc.compact explicitly.
You can still compute the actual overhead by looking at free_words and
live_words in Gc.stat, so I would suggest something like:

open Gc

let check_for_compaction () =
  let gc = Gc.stat () in
  if gc.free_words > gc.live_words * 5 then Gc.compact ()

let cpct_id = GMain.Timeout.add ~ms:10000 ~callback:check_for_compaction

It would be possible to modify lablGTK to allow compaction during
other callbacks, but one would first have to read carefully the code
to see where the dependencies are.

This is for lablgtk. LablTk does not fiddle with compaction, so if you
have a problem you may just need to lower the compaction ratio.

Jacques Garrigue


      parent reply	other threads:[~2007-08-18  0:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-16 22:14 Shivkumar Chandrasekaran
2007-08-17  1:04 ` [Caml-list] " Jacques Garrigue
2007-08-17 14:05   ` Markus Mottl
2007-08-17 15:00     ` Richard Jones
2007-08-17 16:44   ` Shivkumar Chandrasekaran
2007-08-17 19:03     ` Richard Jones
2007-08-18  0:07     ` Jacques GARRIGUE [this message]

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=20070818.090727.2004170775.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=shiv@ece.ucsb.edu \
    /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).