In a C++ class with _com_ptr_t members, will memory leak if CreateInstance() is repeatedly used on the same pointer to get fresh instances of COM objects, without first performing a Release()? It’s well documented that ref count is decremented when one of these smart pointers goes out of scope, and that it is not when the encapsulated pointer is Detach()ed. MSDN doesn’t seem to mention the implications of ref counting when repeating CreateInstance().
In a C++ class with _com_ptr_t members, will memory leak if CreateInstance() is repeatedly
Share
No leak will occur since
_com_ptr_tcallsRelease()at the beginning ofCreateInstance()which you can easily verify yourself by reading_com_ptr_timplementation.