Version française
Home     About     Download     Resources     Contact us    
Browse thread
OCaml and Boehm
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lukasz Stafiniak <lukstafi@g...>
Subject: Re: [Caml-list] OCaml and Boehm
Ouch, we went off-list, that was my mistake...

On Sat, Apr 11, 2009 at 3:33 PM, Basile STARYNKEVITCH
<basile@starynkevitch.net> 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  GC_add_roots
> on every memory segment its allocate. But I would believe that is a bad
> idea.
>
> Maybe adding some extra indirection,  and having the Ocaml -> Boehm pointers
> 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 both
> 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,
£ukasz