caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Michael Hicks <mwh@dsl.cis.upenn.edu>,
	gclist@iecc.com, caml-list@inria.fr
Subject: Re: collecting the collector?
Date: Fri, 29 Oct 1999 10:23:39 +0200	[thread overview]
Message-ID: <19991029102339.16763@pauillac.inria.fr> (raw)
In-Reply-To: <199910212007.QAA25159@codex.cis.upenn.edu>; from Michael Hicks on Thu, Oct 21, 1999 at 04:07:58PM -0400

> I have some code written in OCaml that I've exported to .a file (using the
> standard procedure outlined in the OCaml manual, including using
> -output-obj); this .a file will obviously include the OCaml runtime system,
> and thus its precise collector.  I'm linking this .a file with a C program
> that has its own garbage collector, the Hans-Demers-Weiser conservative
> collector.

I don't know of any OCaml user that actually tried this, but I see no
reason why it shouldn't work.  The OCaml heap is composed of a number
of relatively large blocks (typically 256K), all allocated with malloc()
and chained together for easy reference.  Other data structures for
the OCaml runtime are either in malloc()-ed blocks or in global variables.

A conservative collector a la Boehm-Weiser will just see a bunch of
malloc()-ed blocks, with many pointers from one inside another, and
sufficient chaining to ensure that they are always live as long as the
OCaml code is active.  I can't see anything that could go wrong.

> I'm wondering if anyone has any stories from doing something of this sort
> before, or could at least speculate on how the two collectors will interact.
> I'm presuming that the OCaml collector will be "contained" within the area
> governed by the conservative collector, and so that potential mishaps will
> arise from the Caml collector doing something pointer unsafe,

I'm not sure what you mean by "pointer unsafe" here.  If you're
thinking about those hacks that break conservative collectors, such as
storing the difference or the XOR between two pointers, OCaml doesn't
do any of these.

- Xavier Leroy




  reply	other threads:[~1999-10-29 17:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-21 20:07 Michael Hicks
1999-10-29  8:23 ` Xavier Leroy [this message]
1999-10-29 15:34   ` Michael Hicks

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=19991029102339.16763@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=gclist@iecc.com \
    --cc=mwh@dsl.cis.upenn.edu \
    /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).