caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jörgen Gustavsson" <gustavss@cs.chalmers.se>
To: Chet Murthy <chet@watson.ibm.com>
Cc: <caml-list@inria.fr>
Subject: Re: [Caml-list] Memory management dominates running time
Date: Wed, 8 Jan 2003 13:58:36 +0100 (MET)	[thread overview]
Message-ID: <Pine.SOL.4.30.0301081239490.17168-100000@muppet20.cs.chalmers.se> (raw)
In-Reply-To: <200301051135.h05BZHiY009447@nautilus-chet.watson.ibm.com>

On Sun, 5 Jan 2003, Chet Murthy wrote:

> By using gprof, and doing a little careful counting, you can
> often find out where egregious allocations are happening, and
> eliminate them.

I am afraid that is not my problem right now. I know where the allocations
are and they are necessary in the algorithm we are currently implementing.

The problem is (I believe) that the cost of each allocation is not atomic.
Instead each allocation can under certain circumstances become more and
more expensive as the program runs and eventually the program hardly
does anything but searching for free blocks of memory to allocate. (I
think this happens when data is moved from the minor heap to the major
heap during the minor garbage collection. The free memory in the major
heap is kept in a linked list which is searched linearly for a block of
the right size.) It could actually help to introduce a space leak because
it might lead to less fragmentation.

Thus, when you reason about the asymptotic run time complexity of your
ocaml programs you have to take the internals of the garbage collector
into account which I think is unfortunate. Is it impossible to avoid this
problem with a mark-sweep garbage collector? (With a simple two-space
copying collector the problem disappear.)

In any case we have found a temporary solution to the problem. By setting
max_overhead in the gc control record to 0 one can force heap compaction
to take place at the end of each major GC cycle. This makes the garbage
collector behave like a compacting collector and it becomes very slow
(90% of running time) but the asymptotic problem goes away so it is good
enough for prototyping.

Regards,
    Jörgen Gustavsson.

-------------------
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


  reply	other threads:[~2003-01-08 12:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-03 21:58 Jörgen Gustavsson
2003-01-04  1:20 ` Norman Ramsey
2003-01-05 11:35 ` Chet Murthy
2003-01-08 12:58   ` Jörgen Gustavsson [this message]
2003-01-08 14:20 ` Damien Doligez
2003-01-08 22:23   ` [Caml-list] GlSurf 1.2 available Christophe Raffalli

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=Pine.SOL.4.30.0301081239490.17168-100000@muppet20.cs.chalmers.se \
    --to=gustavss@cs.chalmers.se \
    --cc=caml-list@inria.fr \
    --cc=chet@watson.ibm.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).