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.0 required=5.0 tests=AWL 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 77E9CBBAF for ; Sun, 12 Apr 2009 05:34:39 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnMCANr84EnZSMDji2dsb2JhbACBUpRiAQEBCgsKBw8FsQuDfAY X-IronPort-AV: E=Sophos;i="4.38,431,1233529200"; d="scan'208";a="27528487" Received: from fmmailgate02.web.de ([217.72.192.227]) by mail1-smtp-roc.national.inria.fr with ESMTP; 12 Apr 2009 05:34:39 +0200 Received: from smtp05.web.de (fmsmtp05.dlan.cinetic.de [172.20.4.166]) by fmmailgate02.web.de (Postfix) with ESMTP id 2ECD2FCDAEDF; Sun, 12 Apr 2009 05:34:39 +0200 (CEST) Received: from [78.43.226.218] (helo=frosties.localdomain) by smtp05.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #277) id 1LsqSt-0004aT-00; Sun, 12 Apr 2009 05:34:39 +0200 Received: from mrvn by frosties.localdomain with local (Exim 4.69) (envelope-from ) id 1LsqSr-00046E-MV; Sun, 12 Apr 2009 05:34:37 +0200 From: Goswin von Brederlow To: Basile STARYNKEVITCH Cc: Lukasz Stafiniak , Caml Subject: Re: [Caml-list] OCaml and Boehm References: <4a708d20904101313s49ef3b75m45202b6bda800b77@mail.gmail.com> <49E066E5.8060107@starynkevitch.net> Date: Sun, 12 Apr 2009 05:34:36 +0200 In-Reply-To: <49E066E5.8060107@starynkevitch.net> (Basile STARYNKEVITCH's message of "Sat, 11 Apr 2009 11:46:13 +0200") Message-ID: <873acelf3n.fsf@frosties.localdomain> User-Agent: Gnus/5.110006 (No Gnus v0.6) XEmacs/21.4.21 (linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: goswin-v-b@web.de X-Sender: goswin-v-b@web.de X-Provags-ID: V01U2FsdGVkX18Tp0e82xZ1DV+Z2GLZLipxZK6b2ZgvD6efChZh 1xbbBuvAqwMHDjcxV60TeO1VgLdd5ioOZ8XUm4P+x2si+LIYhy 9RBmAVSh8= X-Spam: no; 0.00; ocaml:01 boehm:01 basile:01 basile:01 lukasz:01 ocaml:01 runtime:01 boehm:01 traversing:01 ocaml's:01 patched:01 runtime:01 pointers:01 pointer:01 bindings:01 Basile STARYNKEVITCH writes: > Lukasz Stafiniak wrote: >> Hi, >> >> Is the OCaml runtime Boehm-safe? That is, can it be run with Boehm >> turned on and traversing OCaml's heap? (So that the OCaml heap can >> provide roots to Boehm.) And if not, could it be patched to make it >> Boehm-safe in this sense? >> >> > Probably not. Because I am not sure of what you mean by Boehm-safe, > since Boehm's GC is conservative and do not make much promises. It makes the promise that a block that is pointed too is never freed. (at least for some form of pointed too) > And very probably, Ocaml runtime cannot realistically be make > Boehm-safe or even Boehm compatible. Correct me if I'm wrong but aren't pointers in ocaml always pointing inside allocated memory instead of its begining? Each block has a header and the ocaml value points to after the header. So every ocaml value would be 4/8 bytes offset to the real address of a block. Can Boehm cope with that at all? > However, it could happen that you might run some Boehm GC code inside > Ocaml if you are lucky. You should be sure that no pointer go from > GC-Boehm zone into Ocaml zone. And probably the other way around too given the above. But you need bindings for any non ocaml code you call so you already have stub functions between ocaml and boehm using code. Any values that pass between the two you can register with each GC. But I fear Boehm has no finalize_* equivalent which you would need to tell the ocaml GC a value as been droped when the Boehm GC frees something. So I would guess you can't pass ocaml pointers into Boehm GC at all without manually handling the resource. > But your question is really too vague. What is the Boehm-GC based code > you want to run within an Ocaml application, and what is that > application? > > Regards. MfG Goswin