Q:

COM:Can i call CoUninitialize without calling Release?

I have a doubt. I initialize COM, do CoCreateInstance and use some interfaces.Can I call CoUninitialize without calling Release? Does it cause any memory/resource leak?
Thanks in Advance,
-Mani.

A:

From MSDN:
http://msdn.microsoft.com/en-us/library/ms688715%28VS.85%29.aspx

CoUninitialize should be called on
  application shutdown, as the last call
  made to the COM library after the
  application hides its main windows and
  falls through its main message loop.
  If there are open conversations
  remaining, CoUninitialize starts a
  modal message loop and dispatches any
  pending messages from the containers
  or server for this COM application. By
  dispatching the messages,
  CoUninitialize ensures that the
  application does not quit before
  receiving all of its pending messages.
  Non-COM messages are discarded.

You should only ever call CoUninitialize on shutdown and by that time it doesn't matter if you have a memory leak.

