Probably heap corruption, but could it be something else?

I have the following c++ code running in a multi-threaded environment:

A* a = (A*) (_x->b); a->DoStuff();

A is a concrete class, _x is a member of A (let's say of type X* ) and b is a void * .

In addition, this is also an A* , and it has a different memory location, but similar data to what the dump shows is at _x->b .

I am encountering an inexplicable crash at the dereference. The dump file that's generated is very detailed, and it shows me that _x is in good state and _x->b points to a valid non-zero memory address. The dump also shows that at the second statement, a is 0, which is the reason the crash occurred in the first place.

My question: is the cause of this crash a definite heap corruption, or could it be something more fundamental? I am planning to debug this with heap tracking tools such as gflags or valgrind, but I was curious if there is any other reason where a seemingly valid pointer would somehow become null after a c-style cast.

链接地址: http://www.djcxy.com/p/14448.html

上一篇: 多核汇编语言的外观如何?

下一篇: 可能堆腐败,但它可能是别的东西?