2

运行我的程序时,我从 Boehm GC 收到以下错误(定义了 GC_DEBUG):

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)
...

以上持续约20次。

奇怪的是,我找不到程序有什么问题,它做了它应该做的事情,并且没有崩溃。

我可以编译禁用 GC 的程序。然后我可以用它运行 valgrind,但奇怪的是,valgrind 没有发现任何问题!

这可能是 Boehm GC 中的一个问题——我应该忽略它吗?

有谁知道如何有效地调试这个?

或者,任何人都可以解释上述消息的确切含义吗?

4

1 回答 1

6

To answer my own question more than 3 months later...

I've tried logging every pointer into a file, and comparing with pointers that gave the smashed warning. However, that didn't lead anywhere, the suspect pointers were coming from various allocations all over the codebase (no one particular place that was maybe broken).

In the meantime, without GC, valgrind didn't report any errors, but of course that doesn't mean it's not possible errors still exist.

However, I figured I'd try if this particular version of the GC has a subtle bug maybe. I was using the latest stable version GC 7.1. I upgraded to 7.2alpha4, and the problem went away!

If someone runs across this, hopefully this will help.

于 2011-03-13T17:33:05.553 回答