<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/01/733fceb4a11bd478e10971ac4ec213da"
  from="Jörgen_Gustavsson &lt;gustavss@c...&gt;"
  author="Jörgen_Gustavsson"
  date="2003-01-08T12:58:39"
  subject="Re: [Caml-list] Memory management dominates running time "
  prev="2003/01/3f2bfcf520c7508366615239172e76c7"
  next="2003/01/e8ee9d44073ff9cb7d257fef86bc8f53"
  prev-in-thread="2003/01/203d53f5ef719129cb2f7f8b230e4574"
  next-in-thread="2003/01/e8ee9d44073ff9cb7d257fef86bc8f53"
  prev-thread="2003/01/d89aa4bddc31c6f04c1b3b3cc50d0853"
  next-thread="2003/01/8822d3df66a08ab1cf8eb00f8fdaf3de"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Memory management dominates running time">
<msg 
  url="2003/01/7100c562b1af5753ac217cb7460456f7"
  from="Jörgen_Gustavsson &lt;gustavss@c...&gt;"
  author="Jörgen_Gustavsson"
  date="2003-01-03T21:58:38"
  subject="[Caml-list] Memory management dominates running time">
<msg 
  url="2003/01/4cbf5f649cf4149c1b629b97bc73ddd2"
  from="Norman Ramsey &lt;nr@e...&gt;"
  author="Norman Ramsey"
  date="2003-01-05T18:00:40"
  subject="Re: [Caml-list] Memory management dominates running time ">
</msg>
<msg 
  url="2003/01/203d53f5ef719129cb2f7f8b230e4574"
  from="Chet Murthy &lt;chet@w...&gt;"
  author="Chet Murthy"
  date="2003-01-08T01:57:17"
  subject="Re: [Caml-list] Memory management dominates running time ">
<msg 
  url="2003/01/733fceb4a11bd478e10971ac4ec213da"
  from="Jörgen_Gustavsson &lt;gustavss@c...&gt;"
  author="Jörgen_Gustavsson"
  date="2003-01-08T12:58:39"
  subject="Re: [Caml-list] Memory management dominates running time ">
</msg>
</msg>
<msg 
  url="2003/01/e8ee9d44073ff9cb7d257fef86bc8f53"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2003-01-08T14:19:54"
  subject="Re: [Caml-list] Memory management dominates running time">
<msg 
  url="2003/01/ce7780f4e0c6590184c7fd1d4991712f"
  from="Christophe Raffalli &lt;Christophe.Raffalli@u...&gt;"
  author="Christophe Raffalli"
  date="2003-01-09T06:42:49"
  subject="[Caml-list] GlSurf 1.2 available">
</msg>
</msg>
</msg>
</thread>

<contents>
On Sun, 5 Jan 2003, Chet Murthy wrote:

&gt; By using gprof, and doing a little careful counting, you can
&gt; often find out where egregious allocations are happening, and
&gt; 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

</contents>

</message>

