Microsoft KB Archive/293278

= PRB: Problems When You Call CoInitialize and CoUninitialize Repeatedly in Multithreaded Apartment =

Article ID: 293278

Article Last Modified on 9/24/2002

-

APPLIES TO


 * Microsoft COM+ 2.0 Standard Edition

-



This article was previously published under Q293278



SYMPTOMS
If you call the CoInitialize and the CoUninitialize functions repeatedly in a multithreaded apartment, you may notice the following:
 * Problems in the application that makes such calls.
 * High memory and a high event handle count for the process.
 * Delays when you shut down the apartment while you exit the process. When this occurs, the process may appear to stop responding (hang).



CAUSE
This behavior occurs because, during CoUninitialize, every proxy that is created is released by a remote Release call. If this Release does not return for some reason, the call times out. This is repeated for all the proxies. Therefore, the process appears to hang.



RESOLUTION
Microsoft does not recommend that you call CoInitialize and CoUninitialize pairs repeatedly in a multithreaded apartment (MTA). After the multithreaded apartment is created, Microsoft recommends that you keep the multithreaded apartment initialized until you exit the process.



STATUS
This behavior is by design.

Additional query words: hung state multi threaded apartment counitialize

Keywords: kbguidelines kbdcom kbprb KB293278

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.