This is no different than checking for leaks in any C or C ++ code. Use <crtdbg.h> for leak detection, the MSDN library article is here . You will receive a leak report for the factory class if there were not enough IUnknown :: Release () calls.
Link counting interface pointers are a complex COM requirement; you cannot just wave it off. If the client code does not do this, you will have to take care of yourself before passing the pointer to this code. Knowing when the pointer is no longer in use is of course a more complex problem.
source share