caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Guillaume Yziquel <guillaume.yziquel@gmx.ch>
To: ygrek <ygrekheretix@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] A question about GC.
Date: Mon, 13 Jun 2011 14:19:36 +0200	[thread overview]
Message-ID: <20110613121936.GA637@localhost> (raw)
In-Reply-To: <20110613143407.0fe166ce.ygrekheretix@gmail.com>

Le Monday 13 Jun 2011 à 14:34:07 (+0300), ygrek a écrit :
> On Mon, 13 Jun 2011 12:37:46 +0200
> Philippe Wang <mail@philippewang.info> wrote:
> 
> > As far as I know, when OCaml's GC is not working as expected, it's
> > (almost) always because there are blocks allocated outside OCaml's
> > heap (a.k.a. custom blocks).
> 
> Custom blocks are allocated on ocaml heap.

No, not always. Nothing stops you from putting custom blocks outside of
the ocaml heap. It might even sometimes make sense. Though usually
you're fine allocating custom blocks on the ocaml heap with a pointer to
out of heap data.

> > How big are custom blocks? The bigger they are, the worst the behavior
> > tends to be.
> 
> Why?

Because the GC relies on the two last arguments of caml_alloc_custom to
properly evaluate the memory impact of allocating a custom block
together with the data it refers to. It's easy to get it wrong for large
data, and thus miscalibrate the GC on these blocks.

However, the fact that grey values seem to accumulate doesn't seem to
fit with such an simple explanation. But maybe Philippe is thinking
about something else when talking about "big custom blocks allocated
outside of the ocaml heap".

-- 
     Guillaume Yziquel

  reply	other threads:[~2011-06-13 12:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-13  0:35 Yoonseok Ko
2011-06-13  9:40 ` Guillaume Yziquel
2011-06-13 10:37 ` Philippe Wang
2011-06-13 11:34   ` ygrek
2011-06-13 12:19     ` Guillaume Yziquel [this message]
2011-06-13 13:26       ` Philippe Wang
2011-06-13 12:21 ` Gerd Stolpmann
2011-06-13 12:26   ` Guillaume Yziquel

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=20110613121936.GA637@localhost \
    --to=guillaume.yziquel@gmx.ch \
    --cc=caml-list@inria.fr \
    --cc=ygrekheretix@gmail.com \
    /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).