On Mon, 14 Oct 2013 22:17:50 +0200 Peter Bex <peter....@xs4all.nl> wrote:

> On Sun, Oct 13, 2013 at 01:51:01PM +0200, Peter Bex wrote:
>> After adding these checks, I noticed that in a DEBUGBUILD, the
>> hash-table tests started failing consistently with the dreaded
>> "out of memory - heap full while resizing" error.  After spending the
>> weekend groveling through the garbage collector, I finally found a
>> very strange statement in runtime.c: after carefully calculating
>> the new heap size and ensuring it will fit both the current heap
>> and the stack, the heap size is HALVED, for no apparent reason!
>> There isn't even a comment stating why this is done.
>
> I went and asked our tribal elder, and he explained to me that the
> rereclaim function's size calculation is based on the FULL heap size,
> which consists of two halves: fromspace and tospace.
>
> This means that the fix of removing the line that divided the
> size by two would effectively cause the heap to grow by 200% instead
> of 100% in the usual case.  This also suggests the correct fix: to
> change the code that ensures the heap is at least its current size plus
> enough room to accommodate what's on the stack such that it will add
> twice the stack size (because it will be tacked onto both the tospace
> and the fromspace).
>
> So here's the three patches again, with some additional comments in the
> GC for total clarity, so we will never get confused about this again!

Thanks a lot, Peter.  I've pushed your patches.

Best wishes.
Mario
-- 
http://parenteses.org/mario

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to