From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 0EED6BCAE for ; Wed, 6 Jul 2005 09:29:28 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j667TR6Z013127 for ; Wed, 6 Jul 2005 09:29:27 +0200 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 JAA22631 for ; Wed, 6 Jul 2005 09:29:27 +0200 (MET DST) Received: from ext.lri.fr (ext.lri.fr [129.175.15.4]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j667TQP0028923 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Wed, 6 Jul 2005 09:29:27 +0200 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id BC9D119E6D6; Wed, 6 Jul 2005 09:29:26 +0200 (CEST) Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14074-06; Wed, 6 Jul 2005 09:29:26 +0200 (CEST) Received: from smtp.lri.fr (serveur3-5 [129.175.3.5]) by ext.lri.fr (Postfix) with ESMTP id AA42619E620; Wed, 6 Jul 2005 09:29:26 +0200 (CEST) Received: from pc9-152 (pc9-152 [129.175.9.152]) by smtp.lri.fr (Postfix) with ESMTP id 8D1B1CED89; Wed, 6 Jul 2005 09:29:24 +0200 (CEST) Received: from filliatr by pc9-152 with local (Exim 3.36 #1 (Debian)) id 1Dq4LV-0003L6-00; Wed, 06 Jul 2005 09:29:25 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17099.34901.255318.655546@gargle.gargle.HOWL> Date: Wed, 6 Jul 2005 09:29:25 +0200 To: dmitry grebeniuk Cc: caml-list@inria.fr Subject: Re: [Caml-list] GC question In-Reply-To: <1082353890.20050705105902@moldavcable.com> References: <1082353890.20050705105902@moldavcable.com> X-Mailer: VM 7.19 under Emacs 21.4.1 From: Jean-Christophe Filliatre X-Virus-Scanned: by amavisd-new at lri.fr X-Miltered: at nez-perce with ID 42CB8857.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42CB8856.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 filliatre:01 filliatre:01 lri:01 grebeniuk:01 heap:01 val:01 heap:01 alloc:01 quicker:98 writes:01 integer:01 dmitry:01 referenced:01 referenced:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: dmitry grebeniuk writes: > > I have some objects (custom blocks with method suite attached) > which can be referenced from caml heap. How to ensure that > finalisation function is called for all non-referenced objects? > I know, call to caml_gc_full_major(Val_unit) will do this work, > but it can be costly when there are many values on the heap > (or not?). Are there any quicker solution? (I can make no > assumptions about "age" (young/old) of allocated custom blocks > and about current GC state) The two integer parameters "used" and "max" passed to alloc_custom are controlling how fast the custom blocks are reclaimed by the GC, as explained in section 18.9.2 of the manual (see http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html). I don't think that calling caml_gc_full_major by yourself is a good idea. You should trust the GC; it will eventually reclaim any block that is not referenced anymore. Hope this helps, -- Jean-Christophe