The information in this article applies to:
SYMPTOMSWhen setting a COM object reference to null and possibly attempting to force garbage collection by calling gc(), COM objects may not be released in a timely or predictable fashion. CAUSEIf you do not call ComLib.release, normal garbage-collection will attempt to perform the release for you. However, this mechanism is not guaranteed due to the threading limitations of many COM objects. That is, many COM objects can be called only on the thread on which they were created. Because garbage collection occurs at unpredictable times, the required thread may have expired or may be no longer responding to messages by the time garbage-collection reclaims the object. In addition, this unpredictability can obscure true memory leaks and/or tie up important system resources. RESOLUTIONIt is recommended that you use explicit releases by calling ComLib.release in order to free COM objects in a timely and predictable fashion. MORE INFORMATIONFor example, if you have the following code that creates a COM object in Java:
You would use this to release these COM objects (note all references to COM
objects should be released):
REFERENCES
Please see the Microsoft SDK for Java documentation for more information.
http://support.microsoft.com/support/visualj/ Additional query words: JCOM garbage collection release com objects
Keywords : kbSDKJava300 kbSDKJava310 JCOM JVM kbSDKJava320 |
Last Reviewed: November 16, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |