What can cause VTable pointer to be 0xffffdffffddd in Win32 debug build?

后端 未结 4 1488
遇见更好的自我
遇见更好的自我 2021-01-11 15:40

I am debugging a defect and have narrowed it down to the vtable pointer for an object being 0xffffdffffddd. This answer indicates that Win32 debug builds will gene

相关标签:
4条回答
  • 2021-01-11 16:15

    If you start the program, put a break point at where you create the object. Then add a memory break point. This will fire if you overwrite or delete the memory. Well, or change it in any way.

    Your object will look correct if the memory isn't overwritten, but your vtable may not be depending on compiler specifics.

    It could also be a size problem if you are using inheritance. If you are using any kind of bucket memory or storing objects by anything but the pointer.

    0 讨论(0)
  • 2021-01-11 16:17

    If pMyObject->someMethod() ultimately ends up modifying the myObjects list it will invalidate any of the current iterators.

    Additionally if the pointer data is already deleted this will trigger the same issue.

    0 讨论(0)
  • 2021-01-11 16:31

    Okay wow, so I've been programming in c++ for years and never discovered this until now... There are actually magic numbers/magic debug values that you can lookup to see what's going on with your raw pointers while debugging!

    See here: In Visual Studio C++, what are the memory allocation representations?

    and here: https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_debug_values

    0 讨论(0)
  • 2021-01-11 16:34

    You are using the pointer after it has been released. Get a stack trace from a breakpoint in the destructor to see what is deleting it. Or better yet, use shared_ptr<> to avoid the problem.

    0 讨论(0)
提交回复
热议问题