[Gc] behaviour of GC_local_malloc(0)

Peter Wang wangp at students.cs.mu.oz.au
Wed Apr 19 20:38:27 PDT 2006


Hello,

The following program crashes at the GC_free() line.  I wonder if this
is a bug in gc6.7, or if allocating zero bytes is not allowed.
The crash does not occur with non-thread local allocation, nor with
gc7.0alpha5, though.

    #include <stdio.h>
    #include "gc.h"
    #include "gc_local_alloc.h"

    int main(void)
    {
	void *p;
	GC_init();
	p = GC_local_malloc(0);
	printf("%p\n", p);
	GC_free(p);
	return 0;
    }

I am testing on a x86-64, linux 2.6 machine.

Peter



More information about the Gc mailing list