[Gc] Smashed heap objects
msipos at mailc.net
Sun Jan 2 15:16:41 PST 2011
When running my program I get the following errors from the Boehm GC
(with GC_DEBUG defined):
GC_check_heap_block: found smashed heap objects:
0x8ef1008 in or near object at 0x8ef1010(<smashed>, appr. sz = 29)
0x8ef1188 in or near object at 0x8ef1190(<smashed>, appr. sz = 29)
The above continues many times.
Oddly, I can't find anything wrong with the program, it does what it is
supposed to, and does not crash. It passes all the unit tests also.
I can compile my program disabling the GC. Then I can run valgrind with
it, but oddly enough, valgrind doesn't find any problems. (Of course,
the program balloons up to 300mb.)
Does anyone have any ideas how to effectively debug this? How is it
possible that valgrind does not show any errors but GC does?
Or, can anyone please explain what precisely the above messages mean?
The system is Arch Linux x86, gc 7.1, gcc 4.5.2. The problem happens
when I disable threads as well, so all I really do is call GC_INIT()
first. I use GC_MALLOC(), GC_REALLOC(), GC_FREE(), and a few times
GC_MALLOC_ATOMIC() and GC_STRDUP().
Thanks for any help.
More information about the Gc