From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id AAA11718; Mon, 6 Sep 2004 00:37:21 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 AAA11821 for ; Mon, 6 Sep 2004 00:37:20 +0200 (MET DST) Received: from kraid.nerim.net (smtp-100-sunday.nerim.net [62.4.16.100]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i85MbJ7T021961 for ; Mon, 6 Sep 2004 00:37:19 +0200 Received: from localhost (karryall.dnsalias.org [62.4.18.180]) by kraid.nerim.net (Postfix) with ESMTP id 59E8F40E5C; Mon, 6 Sep 2004 00:37:17 +0200 (CEST) Date: Mon, 06 Sep 2004 00:37:18 +0200 (CEST) Message-Id: <20040906.003718.74752136.oandrieu@nerim.net> To: shiv@ece.ucsb.edu Cc: caml-list@pauillac.inria.fr Subject: Re: [Caml-list] lablgtk2 & GC compact From: Olivier Andrieu In-Reply-To: <41386479.7000807@ece.ucsb.edu> References: <41386479.7000807@ece.ucsb.edu> X-Mailer: Mew version 4.0.64 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 413B951F.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 lablgtk:01 andrieu:01 andrieu:01 shivkumar:01 2004:99 lablgtk:01 callbacks:01 callback:01 callback:01 caml:01 gtk:01 sep:01 olivier:02 olivier:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Shivkumar Chandrasekaran [Fri, 03 Sep 2004]: > I read in SooHyoung Oh's excellent lablgtk2 tutorial that automatic > compaction was turned off in lablgtk2, and that to get compaction > we must call Gc.compact manually inside the callbacks. Is this > true? Well, not with any callback. You have to be sure that higher in the call stack no GTK function holds a pointer to one of those structures that LablGTK keeps in the caml major heap (GdkColor, GtkTreeIter, GtkTextIter mainly). That's not so easy to make sure. > If so, how do I turn "automatic compaction" back on once I enter the > callback, and off when I exit it? The manual seems to suggest > Gc.set { (Gc.get()) with Gc.max_overhead = 500 } > as the way to turn it on to automatic, and > Gc.set { (Gc.get()) with Gc.max_overhead = 1000000 } > the way to turn it off again. Is this the right thing to do with > lablgtk2? Yes you could do this but of course you'll get a compaction only if a major GC cycle occurs during the callback (and the conditions for a compaction are met). No, I think the idea is rather to let automatic compaction disabled and do manual compaction sometimes. I think it is safe to do so inside a glib timeout, so you could use this to have a compaction happen every hour : Glib.Timeout.add ~ms:(1000 * 60 * 60) ~callback:(fun () -> Gc.compact () ; true) -- Olivier ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners