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=1.8 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 304B8BBAF for ; Sat, 11 Apr 2009 16:11:47 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiADAIdC4EnRVdyuimdsb2JhbACVdj8BAQEKCQwHDwWiSIEJjy8BAwEDg3kG X-IronPort-AV: E=Sophos;i="4.38,431,1233529200"; d="scan'208";a="27505506" Received: from mail-fx0-f174.google.com ([209.85.220.174]) by mail1-smtp-roc.national.inria.fr with ESMTP; 11 Apr 2009 16:11:38 +0200 Received: by fxm22 with SMTP id 22so1401151fxm.9 for ; Sat, 11 Apr 2009 07:11:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=OGBFKcqyiCFVU+qxn+uBUVlz/kEirmkSOTiWjLl9sCg=; b=w4wj6xVkDKbyzd44nRQ+NWifvdT7DRcW0UL0/bydrH92Gd2ywMFyYKevtSl0wlAbfO 8EffoJkWvDIDLaLKvA/sFYBiu/uUzkZBXwStjXdsf4OOm5xdgNph6ko0J4WXiURgVJWS PWKUhM+VU+/T49R4O2hP6ZoYXHwOYE7sx4w1s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=e2S6H2RMEuz7Z5RzOWP/2B2Y4dZBschrbRXejrfqRupKq2i0qXODJldQ0vkEf5khjW dghiWt5S2OZJxuRuxyroxa7sS4cSCJlxP/AzJwA5h4vLmaW9BPULukCZrnm3bLTqMdH5 28WN9BFg0znHgxN3/QNhvWSrwOn+y+kh63nCc= MIME-Version: 1.0 Received: by 10.223.126.203 with SMTP id d11mr1314175fas.22.1239459098628; Sat, 11 Apr 2009 07:11:38 -0700 (PDT) In-Reply-To: <49E09C2D.4080906@starynkevitch.net> References: <4a708d20904101313s49ef3b75m45202b6bda800b77@mail.gmail.com> <49E066E5.8060107@starynkevitch.net> <4a708d20904110511o7d390807r3d29400cf96d6f35@mail.gmail.com> <49E09C2D.4080906@starynkevitch.net> Date: Sat, 11 Apr 2009 16:11:38 +0200 Message-ID: <4a708d20904110711i199ef805h611a04d823c8fb51@mail.gmail.com> Subject: Re: [Caml-list] OCaml and Boehm From: Lukasz Stafiniak To: Basile STARYNKEVITCH , Caml Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; ocaml:01 boehm:01 lukasz:01 off-list:01 basile:01 basile:01 lukasz:01 ocaml:01 gced:01 boehm:01 pointer:01 pointers:01 runtime:01 indirection:01 pointers:01 Ouch, we went off-list, that was my mistake... On Sat, Apr 11, 2009 at 3:33 PM, Basile STARYNKEVITCH wrote: > Lukasz Stafiniak wrote: >> >> Can I call OCaml functions from an application that is GCed by Boehm? >> No pointer goes from GC-Boehm zone to OCaml zone, but there are >> pointers from OCaml to Boehm GC-malloced values that need to be >> respected by Boehm GC. >> > > I don't know, you could just try. > > If you really wanted to, you could hack Ocaml runtime to call =A0GC_add_r= oots > on every memory segment its allocate. But I would believe that is a bad > idea. > > Maybe adding some extra indirection, =A0and having the Ocaml -> Boehm poi= nters > going thru Ocaml custom data and a Boehm mallocated table might do the > trick. > > A valid answer can only be given you by the few persons who know well bot= h > Ocaml runtime implementation & Boehm GC implementation (I do know a bit > about Ocaml runtime, but I did not dive into Boehm's source code). Very > probably Damien Doligez is the right person to ask. > > But why do you want to do such nasty tricks? > > What is your application doing? Is it only a prototype which can > mysteriously crash, or is it a serious program? > It is a large application. They debate whether to use Boehm or smart pointers. They already have embedded Scheme (Guile) and are about to embed Python. (Guile is said to be Boehm-compatible, in some sense, from the next version.) It is possible that Boehm is a no-way for them, I asked here to investigate this. (Another question which is off-topic for this list is whether smart pointers in their situation would be a high performance hit.) Thank You, =A3ukasz