From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 EF495BB83 for ; Tue, 6 Jun 2006 08:35:20 +0200 (CEST) Received: from mail.enyo.de (mail.enyo.de [212.9.189.167]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k566QjWF022506 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Tue, 6 Jun 2006 08:35:20 +0200 Received: from deneb.vpn.enyo.de ([212.9.189.177] helo=deneb.enyo.de) by mail.enyo.de with esmtp id 1FnV1E-00067q-R1; Tue, 06 Jun 2006 08:26:25 +0200 Received: from fw by deneb.enyo.de with local (Exim 4.62) (envelope-from ) id 1FnUEM-0007CA-RD; Tue, 06 Jun 2006 07:35:55 +0200 From: Florian Weimer To: Olivier Andrieu Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Inhibiting heap compaction References: <87y7wfxs7y.fsf@mid.deneb.enyo.de> <17536.40628.573298.310156@karryall.dnsalias.org> Date: Tue, 06 Jun 2006 07:35:54 +0200 In-Reply-To: <17536.40628.573298.310156@karryall.dnsalias.org> (Olivier Andrieu's message of "Fri, 2 Jun 2006 22:25:24 +0200") Message-ID: <87r7227sn9.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at concorde with ID 44852025.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; compaction:01 andrieu:01 stack:01 compaction:01 run-time:01 unacceptable:01 2006:98 heap:01 heap:01 caml-list:01 minor:01 exceptions:01 strings:01 strings:01 int:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 * Olivier Andrieu: > Florian Weimer [Friday 2 June 2006] : > > > > Is it possible to prevent the heap from being compacted, > > Yes. cf the function Gc.set > > Gc.set { (Gc.get()) with Gc.max_overhead = max_int } It looks as if it is possible to modify caml_percent_max directly from C code. Hmm. It would be better if C stack frames could be marked instead. That way, the "no compaction, please" would be cleared automatically even if exceptions are involved. > > Currently, I copy all strings used in such a scenario, but this > > adds quite a bit of overhead. > > Mind that your strings need to be in the major heap for the > no-heap-compaction approach to work. To ensure this, your strings must > be long enough or you should call Gc.minor () before calling the C > function. I had hoped to use Is_young to see if copying the object is still necessary but it's not exported by the run-time library. Well, looks as if I should defer this until copying is truly unacceptable.