[Gc] infinite loop since 6.3alpha5

Paolo Molaro lupus at debian.org
Tue Jun 8 09:37:52 PDT 2004

On 06/05/04 Hans Boehm wrote:
> Thanks.  GC_collect_at_heapsize is being set incorrectly, and may in
> extreme cases like this be less than the actual heap size.  The
> code to set it is erroneously using the old heap size instead of the
> new one.
> Here's a quick attempt at a patch, which I should probably have looked
> at in the morning before sending:


> --- alloc.c.orig        2004-06-05 22:53:14.000000000 -0700
> +++ alloc.c     2004-06-05 22:58:07.000000000 -0700
> @@ -942,12 +942,7 @@
>              (GC_PTR)GC_min((ptr_t)GC_least_plausible_heap_addr,
>                             (ptr_t)space - expansion_slop);
>      }
> -    /* Force GC before we are likely to allocate past expansion_slop */
> -      GC_collect_at_heapsize =
> -         GC_heapsize + expansion_slop - 2*MAXHINCR*HBLKSIZE;
>  #   if defined(LARGE_CONFIG)
> -      if (GC_collect_at_heapsize < GC_heapsize /* wrapped */)
> -       GC_collect_at_heapsize = (word)(-1);
>        if (((ptr_t)GC_greatest_plausible_heap_addr <= (ptr_t)space + bytes
>             || (ptr_t)GC_least_plausible_heap_addr >= (ptr_t)space)
>           && GC_heapsize > 0) {

This hunk fails to apply in alpah5/6 but the patch seems to fix the
issue anyway.
The attached program also used to hang in an infinite loop without the
patch, but it was in a different place thean the earlier one.
The same program exposes also a memory retention issue for me: it ends
up with 400+ MB in top. I know a conservative GC has a hard time with
big allocations, but this one looked excessive so I hope there could be
a way to reduce it. One of the issues is that on my systems, using
GC_DUMP_REGULARLY there seems to be a very large amount of static roots:
	***Static roots:
	From 0x805c000 to 0x806a9d0  (temporary)
	From 0x4003bea0 to 0x4007efe4  (temporary)
	From 0x401a7320 to 0x401b1364  (temporary)
	From 0x40016460 to 0x40016e58  (temporary)
	Total size: 378192

I built the GC with just ./configure; make
and compiled the test with:
gcc -I gc6.3alpha6/include/ -o gc-leak gc-leak.c gc6.3alpha6/.libs/libgc.a -lpthread



lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gc-leak.c
Type: text/x-csrc
Size: 245 bytes
Desc: not available
Url : https://napali.hpl.hp.com/pipermail/gc/attachments/20040608/87424840/gc-leak.c

More information about the Gc mailing list