Fwd: [Gc] crash in GC_free

Jerry Hughes hughesjerry369 at gmail.com
Tue Jun 2 08:34:26 PDT 2009

I finally succeeded building gc v6.8. I had to use the 'old' way from  
the README.QUICK file instead of the new way. Both tests build along  
with the garbage collector succeed. Test.c does not succeed though if  
build and run from Xcode:
GC_malloc(0) failed: GC_size returns 8
Test failed

My own code fails the same way with gc 6.8 than with gc 7.1 : crash on  


> Hi,
> I haven't managed to build gc v6.8 on my Mac. I get that when I try  
> and build it :
> ../darwin_stop_world.c: In function 'GC_push_all_stacks':
> ../darwin_stop_world.c:105: error: 'i386_thread_state_t' has no  
> member named 'esp'
> ../darwin_stop_world.c:107: error: 'i386_thread_state_t' has no  
> member named 'eax'
> ../darwin_stop_world.c:108: error: 'i386_thread_state_t' has no  
> member named 'ebx'
> ../darwin_stop_world.c:109: error: 'i386_thread_state_t' has no  
> member named 'ecx'
> ../darwin_stop_world.c:110: error: 'i386_thread_state_t' has no  
> member named 'edx'
> ../darwin_stop_world.c:111: error: 'i386_thread_state_t' has no  
> member named 'edi'
> ../darwin_stop_world.c:112: error: 'i386_thread_state_t' has no  
> member named 'esi'
> ../darwin_stop_world.c:113: error: 'i386_thread_state_t' has no  
> member named 'ebp'
> I tried test.c That seemed to be a good idea, I got an error:  
> "GC_is_visible produced wrong failure indication"
> If I just include gc.h, I get the same problem.
> What is "bt"? I guess you'd like some more debugging info. Actually,  
> I don't know how the debugger got me all the info. It did only a  
> couple times. Now I only have the compiled code and the stack saying  
> it crashed in GC_free. The couple times I got full debugging info,  
> hhdr was null and that crashed on line 412:     sz = hhdr -> hb_sz;
> There is no use of the garbage collector at all in my code. I just  
> tried and call GC_init(). But with or without that call it crashes  
> the same.
> I am not extending Qt. I use the LGPL Qt 4.5 libraries.
> Jerry
>> Hi!
>> Jerry Hughes <hughesjerry369 at gmail.com> wrote:
>>> Hi,
>>> I want to use the C++ gc in a code I wrote on a Mac OS 10.5 using  
>>> Qt.
>>> The code doesn't use delete at all as it was meant to be garbage
>>> collected. The code obviously has leaks but works fine otherwise.
>>> I build gc 7.1 on my Mac. The test_cpp runs fine.
>> Have You tried gc v6.8? Have You tried test.c?
>>> In my code, all I did was including "gc_cpp.h" and now the program
>>> crashes quite immediately after launch. Apparently somewhere in
>>> GC_free() from malloc.c because hhdr is null.
>> If You would include just "gc.h" (instead of "gc_cpp.h"), does this  
>> lead to a crash too?
>> Could You show "bt" containing GC_free call.
>>> It crashes even if not a single class is derived yet from gc. So, I
>>> don't understand why GC_free is even called.
>> Is GC_[generic_]malloc() (or friends) ever called (even indirectly)  
>> before the crash?
>>> Is it because I use Qt libraries which are not garbage collected?
>> Are You extending Qt classes?
>>> Thanks,
>>> Jerry
>> Bye.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://napali.hpl.hp.com/pipermail/gc/attachments/20090602/f95b7cf0/attachment.htm

More information about the Gc mailing list