Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Markus Mottl <markus.mottl@gmail.com>
To: "Dr. Thomas Fischbacher" <t.fischbacher@soton.ac.uk>
Cc: OCaml List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Custom blocks and finalization
Date: Wed, 6 May 2009 12:54:35 -0400	[thread overview]
Message-ID: <f8560b80905060954h34824bdbv5e7c42a37df0e15d@mail.gmail.com> (raw)
In-Reply-To: <4A01BB13.1040602@soton.ac.uk>

On Wed, May 6, 2009 at 12:30, Dr. Thomas Fischbacher
<t.fischbacher@soton.ac.uk> > I take it you are referring to this part
of the documentation (18.9.1
> bottom):
>
> ===>
[snip]

Yes.

> Do not use CAMLparam to register
> the
> parameters to these functions, and do not use CAMLreturn to return the
> result.

Neither of the above will ever trigger a garbage collection, but they
are still prohibited.  I don't know why these restrictions are
required, but according to the documentation it seems dangerous to
manipulate any runtime datastructures while in a finalizer.

> Let's have a look at byterun/globroots.c:
[snip]
> So... how could caml_remove_global_root() actually trigger a heap GC?

It certainly doesn't, but it obviously manipulates runtime
datastructures which may not necessarily be in a state during
finalization where this is safe.  I'd have to study the runtime code
in detail to learn more, but maybe the OCaml team can clarify this
issue more quickly?

Regards,
Markus

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


  reply	other threads:[~2009-05-06 16:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30 15:46 Markus Mottl
2009-04-30 18:17 ` [Caml-list] " Dr. Thomas Fischbacher
     [not found] ` <49FB04A9.3090008@soton.ac.uk>
2009-05-01 16:00   ` Markus Mottl
2009-05-06 16:30     ` Dr. Thomas Fischbacher
2009-05-06 16:54       ` Markus Mottl [this message]
2009-05-06 17:53         ` Dr. Thomas Fischbacher
2009-05-08  9:36         ` Xavier Leroy
2009-05-08 13:48           ` 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=f8560b80905060954h34824bdbv5e7c42a37df0e15d@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=t.fischbacher@soton.ac.uk \
    /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