FAQ: Why do singletons require special treatment?
Why do singletons require special treatment?
Singletons are a type of COM object that have only one instance per process; code results may be found in errors, if singletons are left hanging (a process known as pinning). In the case of singletons, it is necessary to always unpin or release the reference, regardless of the specific API being used.
For non-.NET APIs, simply set the member variable equal to nothing.
In .NET APIs, use the COMReleaser class to explicitly release the reference.