From: "Markus Mottl" <markus.mottl@gmail.com>
To: "Hendrik Tews" <H.Tews@cs.ru.nl>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] caml_oldify_local_roots takes 50% of the total runtime
Date: Thu, 26 Oct 2006 10:54:43 -0400 [thread overview]
Message-ID: <f8560b80610260754x5dcad432wae422fc70e1a8983@mail.gmail.com> (raw)
In-Reply-To: <wwuejsvv275.fsf@tandem.cs.ru.nl>
[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]
On 10/26/06, Hendrik Tews <H.Tews@cs.ru.nl> wrote:
>
> I don't quite understand: I only have pointers from C++ to ocaml.
> Once constructed the ocaml objects are completely independent
> from the C++ ones.
>
Ok, I thought they were entangled, i.e. there were pointers in both
directions. But you will still need to avoid storing OCaml-values in
C++-values.
If you want to prevent them from being reclaimed as long as the C++-objects
still refer to them, you'll have to store them in e.g. an OCaml-hashtable
using e.g. integer keys as handles. Then you can store the key in the
C++-object as an ordinary C++-value (i.e. no registering with the GC). If
you need the OCaml-value on the C++-side, you just convert the handle to an
OCaml-value, and execute a callback to look up the value associated with the
handle in the hashtable. Btw., if you use an OCaml-int as handle you can
store the "value" directly, because ints need not be registered with the GC
anyway.
Regards,
Markus
--
Markus Mottl http://www.ocaml.info markus.mottl@gmail.com
[-- Attachment #2: Type: text/html, Size: 1553 bytes --]
next prev parent reply other threads:[~2006-10-26 14:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-25 15:49 Hendrik Tews
2006-10-25 18:21 ` [Caml-list] " Markus Mottl
2006-10-25 19:01 ` skaller
2006-10-26 9:50 ` Hendrik Tews
2006-10-26 13:48 ` Gerd Stolpmann
2006-10-27 11:36 ` Hendrik Tews
2006-10-27 13:17 ` Brian Hurt
2006-10-27 20:05 ` Robert Roessler
2006-10-27 21:16 ` Pierre Etchemaïté
2006-10-30 7:50 ` Hendrik Tews
2006-10-26 9:47 ` Hendrik Tews
2006-10-26 14:54 ` Markus Mottl [this message]
2006-12-15 10:56 ` Hendrik Tews
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=f8560b80610260754x5dcad432wae422fc70e1a8983@mail.gmail.com \
--to=markus.mottl@gmail.com \
--cc=H.Tews@cs.ru.nl \
--cc=caml-list@inria.fr \
/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