user494461
user494461

Reputation:

access violation reading location 0xfeef002A

How to see in visual studio whether the address is also accessed from somewhere else at the same time?

what can be the different reasons access violation is cause?

Upvotes: 0

Views: 2001

Answers (1)

the_mandrill
the_mandrill

Reputation: 30862

This looks very close to one of the special values used by the Visual Studio runtime debug heap. There are a number of values that the C runtime uses after memory has been allocated and deallocated so that you can diagnose memory corruption errors more easily. The value 0xFEEEFEEE is used after memory has been freed.

I suspect what may be happening in your code is that an object has been deallocated but you still have a pointer to it (a dangling pointer) and you're trying to access a member variable of that object. There are several things you could do to diagnose this problem, depending on the complexity of your code. One is to enable Page Heap Verification, and the other is to add some breakpoints in the destructor of the class that is being dereferenced so find out where the object is being destroyed so you can reset the other pointers that reference it. Consider using smart pointers such as shared_ptr<> to reduce the likelihood of dangling pointers.

Upvotes: 2

Related Questions