Reputation: 129
I have a pointer to a COM object (in C++). Is there a way to get the current reference count of the object which the pointer is pointing to?
Upvotes: 3
Views: 6962
Reputation: 69734
Call IUnknown::AddRef
and then immediately IUnknown::Release
. The value returned by the latter is current count of outstanding references. Note that the value does not have to be accurate, it is informational only.
Upvotes: 11