caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Damien Doligez <damien.doligez@inria.fr>
To: Markus Mottl <markus@oefai.at>
Cc: OCAML <caml-list@inria.fr>
Subject: Re: [Caml-list] GC and preventing data relocation
Date: Fri, 21 Mar 2003 17:15:16 +0100	[thread overview]
Message-ID: <4DE5D5EC-5BB8-11D7-856E-0003930FCE12@inria.fr> (raw)
In-Reply-To: <20030320151647.GA15121@fichte.ai.univie.ac.at>

On Thursday, March 20, 2003, at 04:16 PM, Markus Mottl wrote:

> Since there is no way for me to tell the C-library to continue with a
> new location of the string, I'd like to know whether there is any way
> to prevent the GC from moving specific data?

In the current implementation (and in the foreseeable future), if your
string is in the major heap, then only the compactor can move it.
You could try to disable the automatic compaction (by setting
max_overhead to 1 million) during the callback, restoring the
original setting when you get out of the callback.  You'll have
to tell your users that they must not call Gc.compact nor change
max_overhead during the execution of the callback function.

You will also have to correctly manage the case where the callback
function raises an exception...

If the string is in the minor heap, you know it's a short string
and you can (for example) copy it into a buffer pre-allocated in
the C heap.

-- Damien

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2003-03-21 16:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-20 15:16 Markus Mottl
2003-03-20 18:28 ` Christopher Quinn
2003-03-21  0:01   ` Markus Mottl
2003-03-21  1:15     ` Christopher Quinn
2003-03-21 12:03       ` Markus Mottl
2003-03-21 16:15 ` Damien Doligez [this message]
2003-03-21 16:35   ` Markus Mottl
2003-03-24  6:14     ` Nicolas Cannasse
2003-03-24  8:58       ` 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=4DE5D5EC-5BB8-11D7-856E-0003930FCE12@inria.fr \
    --to=damien.doligez@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=markus@oefai.at \
    /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).