caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: Basile STARYNKEVITCH <basile@starynkevitch.net>
Cc: Lukasz Stafiniak <lukstafi@gmail.com>, Caml <caml-list@inria.fr>
Subject: Re: [Caml-list] OCaml and Boehm
Date: Sun, 12 Apr 2009 05:34:36 +0200	[thread overview]
Message-ID: <873acelf3n.fsf@frosties.localdomain> (raw)
In-Reply-To: <49E066E5.8060107@starynkevitch.net> (Basile STARYNKEVITCH's message of "Sat, 11 Apr 2009 11:46:13 +0200")

Basile STARYNKEVITCH <basile@starynkevitch.net> 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


  parent reply	other threads:[~2009-04-12  3:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-10 20:13 Lukasz Stafiniak
2009-04-11  9:46 ` [Caml-list] " Basile STARYNKEVITCH
2009-04-11 10:42   ` Jon Harrop
     [not found]   ` <4a708d20904110511o7d390807r3d29400cf96d6f35@mail.gmail.com>
     [not found]     ` <49E09C2D.4080906@starynkevitch.net>
2009-04-11 14:11       ` Lukasz Stafiniak
2009-04-11 14:27         ` Jon Harrop
2009-04-11 14:40           ` Lukasz Stafiniak
2009-04-11 20:40             ` Jon Harrop
2009-04-11 15:03         ` Basile STARYNKEVITCH
2009-04-11 20:41           ` Jon Harrop
2009-04-13  9:42           ` Christoph Bauer
2009-04-13 13:15             ` Lukasz Stafiniak
2009-04-14  5:25               ` Goswin von Brederlow
2009-04-12  3:34   ` Goswin von Brederlow [this message]
2009-04-12 12:09     ` Lukasz Stafiniak
2009-04-13 17:36 ` Xavier Leroy
2009-04-11 19:17 Ed Keith
2009-04-11 20:36 ` Jon Harrop
2009-04-12  3:25   ` Goswin von Brederlow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873acelf3n.fsf@frosties.localdomain \
    --to=goswin-v-b@web.de \
    --cc=basile@starynkevitch.net \
    --cc=caml-list@inria.fr \
    --cc=lukstafi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).