chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] Another subtle GC problem


From: Moritz Heidkamp
Subject: Re: [Chicken-hackers] [PATCH] Another subtle GC problem
Date: Wed, 23 Oct 2013 11:43:24 +0200

Hi,

Peter Bex <address@hidden> writes:
> I decided to take another look at the GC in an attempt to
> understand it better, and found yet another iffy line of code:
>
> When comparing the heap growth to the current heap size plus
> the stack size, two unsigned quantities are subtracted from
> eachother (size is a C_uword parameter to C_rereclaim2,
> heap_size is a size_t, which is also unsigned), and then
> compared to be less than stack_size * 2.
>
> If the heap is not growing, but shrinking, this unsigned
> subtraction will underflow and cause it to result in a
> huge value.  This happens to work, but I think the attached
> patch makes it more explicit what's really happening: it
> only does the subtraction and comparison when the new size
> is bigger than the old heap size (so we're growing the heap,
> due to memory pressure).

looks OK and works fine AFAICT. Pushed!


> When shrinking the heap, this check won't need to be run because
> we've just done a GC, so there *should be* no pressure on
> the nursery, so it won't get copied to the heap.  But I don't
> fully grok this part yet, so don't take my word for it.

So this would get rid of one comparsion operation per major GC? I'd
guess this is negligible, no?

Thanks!
Moritz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]