From: Jeremy Yallop <yallop@gmail.com>
To: "Christoph Höger" <christoph.hoeger@tu-berlin.de>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Garbage collector woes
Date: Mon, 4 Jul 2016 18:44:48 +0100 [thread overview]
Message-ID: <CAAxsn=FwDzsk66DbUpCb71uArLisunJARs6wrvcpDu3iMm_SVg@mail.gmail.com> (raw)
In-Reply-To: <8ff1d18d-581a-0269-fb0d-5bc70a1a9acd@tu-berlin.de>
On 4 July 2016 at 18:06, Christoph Höger <christoph.hoeger@tu-berlin.de> wrote:
> Am 04.07.2016 um 18:21 schrieb Jeremy Yallop:
>> I'm guessing that 'desc' points to a block and N, MFIT and ICONV are
>> field accessors.
>
> That is correct. N, MFIT and ICONV are macros defined as Field(.., ..).
>
>> If so, you need to register 'desc' as a root here, since
>> caml_copy_double or caml_ba_alloc_dims could trigger a gc, moving desc
>> before it's next used.
>
> By registering as a root you mean to also declare it via CAMLlocal?
Yes, that's a reasonable way to do it.
> Is this necessary/appropriate, since &desc is already a registered global root.
In fact, &desc is not a registered global root, since desc is a local
variable, with its own fresh address. It's user_data that's a global
root, and desc is simply a copy of the contents of user_data. So when
the GC updates *user_data, desc is left unchanged.
> Do you have any clue how that moving of desc could trigger the
> overwriting of x and cond?
If the GC replaces the value that desc points to with some other value
that's then invoked as a callback, pretty much anything can happen.
(Of course, it's also possible that the problem lies somewhere else
entirely.)
prev parent reply other threads:[~2016-07-04 17:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-04 16:04 Christoph Höger
2016-07-04 16:21 ` Jeremy Yallop
2016-07-04 17:06 ` Christoph Höger
2016-07-04 17:44 ` Jeremy Yallop [this message]
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='CAAxsn=FwDzsk66DbUpCb71uArLisunJARs6wrvcpDu3iMm_SVg@mail.gmail.com' \
--to=yallop@gmail.com \
--cc=caml-list@inria.fr \
--cc=christoph.hoeger@tu-berlin.de \
/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