caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
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: Wed, 25 Oct 2006 14:21:14 -0400	[thread overview]
Message-ID: <f8560b80610251121x10c113faif3e8a50ef0a9415c@mail.gmail.com> (raw)
In-Reply-To: <17727.34685.561877.977822@tandem.cs.ru.nl>

[-- Attachment #1: Type: text/plain, Size: 1323 bytes --]

Hi,

On 10/25/06, Hendrik Tews <H.Tews@cs.ru.nl> wrote:
>
> >From the comments of Damien Doligez in a related thread in
>
> http://caml.inria.fr/pub/ml-archives/caml-list/2004/07/84cd291931627c13faf56a259026885c.en.html
> I got the impression that there is extra punishment for
> caml_local_roots. Should the situation improve if I organize the
> 350.000 ocaml node pointers on the ocaml side via one local root
> (asumming this information is needed not so often)?
>

This is a known problem: the OCaml-runtime calls this function
(caml_oldify_local_roots) at each minor collection.  The function iterates
over all local roots, and since minor collections happen quite often, this
naturally leads to excessive CPU-usage - even if hardly anything else is
going on.

To work around this problem you should store pointers to the C++-objects on
the C++-side, and e.g. associate them with finalized OCaml-values, or
handles which allow you to explicitly deallocate the objects.

It would be great if the GC could be improved in situations where there are
many local roots.  This is a pretty common problem when interfacing
non-trivial third party libraries, and the clumsy workarounds require
writing somewhat error-prone code.

Best regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com

[-- Attachment #2: Type: text/html, Size: 1911 bytes --]

  reply	other threads:[~2006-10-25 18:21 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 ` Markus Mottl [this message]
2006-10-25 19:01   ` [Caml-list] " 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
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=f8560b80610251121x10c113faif3e8a50ef0a9415c@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;
as well as URLs for NNTP newsgroup(s).