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 13414BB84 for ; Fri, 2 Jun 2006 21:39:37 +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 k52JdXO4029222 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 2 Jun 2006 21:39:36 +0200 Received: from deneb.vpn.enyo.de ([212.9.189.177] helo=deneb.enyo.de) by mail.enyo.de with esmtp id 1FmFUL-0006ti-GX for caml-list@yquem.inria.fr; Fri, 02 Jun 2006 21:39:17 +0200 Received: from fw by deneb.enyo.de with local (Exim 4.62) (envelope-from ) id 1FmFUH-00071v-Iz for caml-list@yquem.inria.fr; Fri, 02 Jun 2006 21:39:13 +0200 From: Florian Weimer To: caml-list@yquem.inria.fr Subject: Inhibiting heap compaction Date: Fri, 02 Jun 2006 21:39:13 +0200 Message-ID: <87y7wfxs7y.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at concorde with ID 448093F6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; compaction:01 lib:01 invokes:01 invokes:01 compaction:01 heap:01 heap:01 strings:01 argument:01 argument:01 func:01 func:01 caml:02 caml:02 callback:02 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 Is it possible to prevent the heap from being compacted, or pin individual objects? Suppose I write a C function C_func, which takes a string argument. It passes that argument to some library function lib_func (which has been written by a third party). bar invokes a C callback C_cb. In my wrapper for Caml, C_cb invokes the Caml function cb. cb conses and triggers heap compaction. After return from cb and C_cb, bar uses the old address of the string, which is incorrect. Currently, I copy all strings used in such a scenario, but this adds quite a bit of overhead.