How can I determine if a C++ object has been deallocated?

You can’t easily tell just by looking at the memory location if the object is still allocated or not. There might be some black magic tricks to do that, but a much cleaner way would be to build a call-back mechanism into the object’s destructor.

Leave a Comment