caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Stopping and continuing GC
Date: Fri, 17 Aug 2007 16:00:29 +0100	[thread overview]
Message-ID: <20070817150029.GA5052@furbychan.cocan.org> (raw)
In-Reply-To: <f8560b80708170705j761dff55s50433da0562ebdb4@mail.gmail.com>

On Fri, Aug 17, 2007 at 10:05:41AM -0400, Markus Mottl wrote:
> This, btw., raises an interesting question: are there any ways (and
> hopefully even intentions) to make compaction work in slices like the
> major GC does?  We write extremely latency sensitive applications and
> often even have to manually control when the GC performs collections.
> 
> Unfortunately, compaction cannot be controlled in the same way as the
> major GC can be (e.g. calling the major GC with a specific slice
> size).  That's why we have to turn off automatic compactions, too, and
> run these latency sensitive applications on machines with very large
> amounts of memory.

I looked at the code in byterun/compact.c (I've been looking at the
internals of the GC quite a bit this week) and at first glance it
seems like it overwrites headers in the heap temporarily while
compacting.  So any incremental compactor looks like it would involve
quite a rewrite.

But I wonder in general terms about the problem you are having, which
is surely a fragmentation issue (exactly the same as you'd see in a C
program).  Can this be cured by examining what sizes of structures you
are allocating?  Perhaps you can pad out or trim common structures so
that they are the same size, thus avoiding fragmentation?  A second
possibility is that it's an interaction between the OCaml heap blocks
and the underlying C malloc allocator.  It might be that OCaml is
requesting allocations which always require more memory from the
operating system (ie. they are too large or awkwardly sized to satisfy
from free areas within the current C heap).  It should be relatively
easy to diagnose either situation: For the first you'd need a program
to walk the Caml heap looking at the sizes of blocks, which you'd run
in a process that has been running for some time.  For the second,
instrument calls to malloc (in caml_alloc_for_heap).

That's just from a cursory look at the code anyway -- there is
probably much that I'm missing, but instrumenting those would be a
start.

Rich.

-- 
Richard Jones
Red Hat


  reply	other threads:[~2007-08-17 15:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-16 22:14 Shivkumar Chandrasekaran
2007-08-17  1:04 ` [Caml-list] " Jacques Garrigue
2007-08-17 14:05   ` Markus Mottl
2007-08-17 15:00     ` Richard Jones [this message]
2007-08-17 16:44   ` Shivkumar Chandrasekaran
2007-08-17 19:03     ` Richard Jones
2007-08-18  0:07     ` Jacques GARRIGUE

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=20070817150029.GA5052@furbychan.cocan.org \
    --to=rich@annexia.org \
    --cc=caml-list@inria.fr \
    /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).