[Gc] GC 6.4 simplified leak detection breaks on SuSE Linux9.3i386(glibc 2.3.4)

Matthias Andree matthias.andree at gmx.de
Tue May 17 02:18:08 PDT 2005

On Mon, 16 May 2005, Hans Boehm wrote:

> It looks like the GC initialization routine is being called recursively,
> because the initialization routine forces a GC (around line 782, misc.c)
> just before setting the GC_is_initialized flag.  That unfortunately
> again generates a backtrace, which allocates, which invokes the GC,
> which restarts the initialization.
> Can you try commenting out the three calls to GC_save_callers in
> alloc.c?  They're really only needed for GC debugging, I believe.
> If that solves the problem, we can conditionally take them out.
> (I'm pretty sure this will help.  I'm less sure this is the last
> such problem.)

Now we're getting somewhere :-)

My simple test program (attached) worked with gc6.4 with

#1 the patch you posted earlier,
#2 the return inserted into the if (GC_in_save_callers) {} block
#3 the three GC_save_callers in alloc.c masked by #if 0

and produced this:

got 0x805af88
got 0x805af18
Leaked composite object at 0x805af88 (unknown:0, sz=42, NORMAL)
        Call chain at allocation:
                /tmp/gc6.4/.libs/libgc.so(GC_debug_malloc+0xac) [0xb7fc8aeb]
                /tmp/gc6.4/.libs/libgc.so(malloc+0x27) [0xb7fcc6b3]
                main:../../../src/tests/leakmem.c:17 [0x8048440]

which is the expected output.

There still seems to be something problematic going on though, but it
may be an unsupported configuration since it affects a program that
might be using Berkeley DB 4.3, and this might in turn pull in
libpthread for futex support, and AFAICS this "simplified leak
detection" isn't even supposed to work with threads.

I don't have time to debug this now or provide detailed info, more later
if I can reproduce the problem.

Thanks so far.

Matthias Andree
-------------- next part --------------
 * \file leakmem.c
 * deliberately leaks memory, to test memory checkers.
 * \author Matthias Andree
 * \date 2005
 * GNU General Public License v2

#include <stdlib.h>
#include <stdio.h>

int main(void) {
    char *x;

    x = malloc(42);
    printf("got %p\n", x);
    /* deliberately leak memory here */
    x = malloc(42);
    printf("got %p\n", x);
    return 0;

More information about the Gc mailing list