Heap corruption: What could the cause be?

后端 未结 13 1547
时光取名叫无心
时光取名叫无心 2020-12-25 12:56

I am investigating a crash due to heap corruption. As this issue is non-trivial and involves analyzing the stack and dump results, I have decided to do a code review of file

13条回答
  •  抹茶落季
    2020-12-25 13:28

    An additional debugging tip is to look at the values that are being written to the wrong place using the raw memory view. Is it writing zeros... strings... some other recognizable number pattern? If you can see the corrupted memory at some point after the error occurs, that can provide a hint of the code that caused it.

    Also always set pointers to null after deleting them even in destructors. Sometimes unexpected things can be triggered during a destructor chain in a base class than cause an access to a partially deleted sub-class.

提交回复
热议问题