<div dir="ltr">Thanks Elijah, that&#39;s very helpful. So this is what I&#39;m taking away from what you said, if you don&#39;t mind correcting me anywhere I&#39;m wrong, that would be lovely<div><br></div><div>- we can lock out the gc for the duration of a piece, this is reasonable</div><div>- but to do so, we should definitely establish the upper bound of the heap size you need and pre-allocate it</div><div>- we really don&#39;t want to get this wrong, because doubling the heap part way through will be (probably) an underrun, as everything in the old heap gets copied to the new one</div><div>-  once the heap is big, only a reboot of the interpreter will bring it back down again.</div><div><br></div><div>One thing I&#39;m not clear on: is it necessarily a lot slower for the gc to do a run with a large heap, even if the heap is not in use? Or is the bottleneck the number of objects the gc goes trawling through?</div><div>I guess another way of putting that is: is there any real disadvantage to over-allocating the heap size aside from using up RAM?</div><div><br></div><div>Thanks so much!</div><div>iain</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 9, 2021 at 9:42 PM Elijah Stone &lt;<a href="mailto:elronnd@elronnd.net">elronnd@elronnd.net</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, 9 Sep 2021, Iain Duncan wrote:<br>
<br>
&gt; Is there a way to pre-emptively make the heap big from c or scheme, <br>
&gt; aside from compiling in a default size?<br>
(set! (*s7* &#39;heap-size) ...)<br>
<br>
&gt; So I&#39;m wondering if it would be reasonable to give users an option to <br>
&gt; trade size for speed by allocating a big hunk of memory and cleaning up <br>
&gt; when it doesn&#39;t matter.<br>
That is very reasonable, but note that you cannot shrink the heap.<br>
<br>
&gt; does a heap resize take a long time?<br>
It requires copying the entire heap.  Probably not something you would <br>
want to do in real-time.<br>
<br>
&gt; Do they take progressively more time (ie does the heap double or <br>
&gt; somesuch thing)<br>
Yes, it doubles.  (Obviously this also means you&#39;re asymptotically less <br>
likely to need a resize as time goes on...)<br>
<br>
  -E<br>
_______________________________________________<br>
Cmdist mailing list<br>
<a href="mailto:Cmdist@ccrma.stanford.edu" target="_blank">Cmdist@ccrma.stanford.edu</a><br>
<a href="https://cm-mail.stanford.edu/mailman/listinfo/cmdist" rel="noreferrer" target="_blank">https://cm-mail.stanford.edu/mailman/listinfo/cmdist</a><br>
</blockquote></div>