caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <mottl@miss.wu-wien.ac.at>
To: Xavier Leroy <Xavier.Leroy@inria.fr>
Cc: OCAML <caml-list@inria.fr>
Subject: Re: fancy GC question
Date: Thu, 14 Dec 2000 00:06:49 +0100	[thread overview]
Message-ID: <20001214000649.A26410@miss.wu-wien.ac.at> (raw)
In-Reply-To: <20001212163839.B26381@pauillac.inria.fr>; from Xavier.Leroy@inria.fr on Tue, Dec 12, 2000 at 16:38:39 +0100

On Tue, 12 Dec 2000, Xavier Leroy wrote:
> It is safe if the C code does not perform any allocation in the Caml
> heap while it is using the "ar" pointer.  An allocation can trigger a
> garbage collection, which can move the Caml block denoted by "v_ar";
> after this, the "ar" pointer no longer points inside the block!

Yes, this should also be avoided. Another problem that comes
to my mind now is that this makes it rather unwise to use the
"enter/leave_blocking_section"-functions when using this trick: another
thread could then trigger a collection while the C-function is still
writing to the array - right?

> > Can other effects mess up the
> > fact that the pointers map continuously on a contiguous chunk of memory
> > (of integers)?
> 
> I'm not sure I understand the question, but the various "fields" of a
> Caml block (as accessed with the Field macro) are always contiguous in
> memory.

Ah, stupid thinking on my side - I get schizophrenic after four o'clock in
the morning and pose several questions in one (everything clear now)... ;)

- Markus

-- 
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl



  reply	other threads:[~2000-12-14 18:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-12  3:05 Markus Mottl
2000-12-12 15:38 ` Xavier Leroy
2000-12-13 23:06   ` Markus Mottl [this message]
2000-12-12 12:18 Damien Doligez
2000-12-14 22:10 Markus Mottl

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=20001214000649.A26410@miss.wu-wien.ac.at \
    --to=mottl@miss.wu-wien.ac.at \
    --cc=Xavier.Leroy@inria.fr \
    --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).