How to get the current reference count of an object?

好久不见. 提交于 2019-12-11 03:59:48

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/30703812/how-to-get-the-current-reference-count-of-an-object

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!