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: Fri, 17 Aug 2007 10:04:53 +0900 (JST)	[thread overview]
Message-ID: <20070817.100453.94562786.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <B27F0313-86A3-4F82-ACEB-A76659809418@ece.ucsb.edu>

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

> I noticed that both lablTK and lablGTK turn off GC and recommend  
> using it within callbacks where it is safe. My program consumes tons  
> of memory and I need to continue GC at the start of my callbacks and  
> stop it again as I exit, frequently in the code. Are there any easy /  
> standard Gc.___ calls to do the job "correctly". Thanks in advance,

This looks like a misunderstanding.
You cannot stop the GC in ocaml: it will be triggered as soon as the
young heap is full anyway.
What lablGTK does is turning off compaction, which is a rather new
feature of the GC (didn't exist when lablgtk was first written), which
moves around objects in the old generation, which would break some
assumptions in the code. As indicated, you can still call compaction
explicitly, a simple way being to call Gc.major once in a
while (using a timer for instance), as it will do compaction too when
needed. My understanding is that compaction is atomic, so there is no
notion of starting and stopping it, just of allowing it or not.
I don't remember anything similar in LablTk.

In usual practice, you should not have to do anything special.

Jacques Garrigue


  reply	other threads:[~2007-08-17  1:05 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 ` Jacques Garrigue [this message]
2007-08-17 14:05   ` [Caml-list] " 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

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=20070817.100453.94562786.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).