I have a previous question that was answered in which I describe difficulties catching an exception when I try to access an object that has been deallocated by a third-party
create a destructor that notifies upon desrtruction. It could even toggle a bool, if you wanted to check it during runtime.
class free
{
public:
~free() { cout << "Im being freed " << endl; } //destructor output
};
This will output in console that its being freed. After being freed, any reference to it will be undefined behaviour, even if it appears to exist.