出于调试原因,我想销毁仍然作为引用的类实例。那可能吗?它不必优雅或稳定,因为这永远不会出现在生产代码中。
澄清:
Public Sub Main
Dim o as MyClass
Set o = New MyClass //o is created, one reference
DestroyObject o //Class_Terminate is called and the object destroyed
//Further code, not using o
End Sub //Possible runtime error here (don't care)
那可能吗?一种方法是调用IUnknown::Release
手动减少引用计数,但是我现在必须多久调用一次呢?