[Gc] Can unions 'fool' the garbage collector?

Alec Orr Alec.Orr at wbemsolutions.com
Thu Jun 17 14:16:47 PDT 2004


Folks:

   RH Linux 9.0
   GC 6.2 (Still meaning to upgrade to 6.3)
   No memory redirection.
   Posix threads.
   enable full debug/enable assertions

Has anyone seen the following behavior with C unions?

Declare a structure S with a union member on the stack
GC_MALLOC returns address X
Address X is assigned to a char* member of the union.
Full World Garbage Collect.
GC_MALLOC returns address X again (i.e the GC thinks address X is not 
'in-use').

A subsequent free shows:

GC_debug_free: found previously deallocated (?) object at 0x805deb0 in 
object at 0x805deb8 (<smashed>, appr. sz = 5)

Anyone seen anything like this?

Thanks folks,
Alec Orr





More information about the Gc mailing list