From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 3A1A5BC69 for ; Fri, 17 Aug 2007 03:05:17 +0200 (CEST) Received: from rabbit.math.nagoya-u.ac.jp (rabbit.math.nagoya-u.ac.jp [133.6.130.5]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l7H15Fdv022953 for ; Fri, 17 Aug 2007 03:05:16 +0200 Received: from localhost (rabbit-172 [172.16.254.254]) by rabbit.math.nagoya-u.ac.jp (8.12.11/3.7W) with ESMTP id l7H1543J014110; Fri, 17 Aug 2007 10:05:04 +0900 (JST) Date: Fri, 17 Aug 2007 10:04:53 +0900 (JST) Message-Id: <20070817.100453.94562786.garrigue@math.nagoya-u.ac.jp> To: shiv@ece.ucsb.edu Cc: caml-list@inria.fr Subject: Re: [Caml-list] Stopping and continuing GC From: Jacques Garrigue In-Reply-To: References: X-Mailer: Mew version 4.2 on Emacs 22.1 / 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 46C4F44B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; shivkumar:01 labltk:01 lablgtk:01 callbacks:01 callbacks:01 ocaml:01 lablgtk:01 compaction:01 compaction:01 labltk:01 heap:01 caml-list:01 shiv:02 explicitly:02 objects:02 From: Shivkumar Chandrasekaran > 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