releases COM resources held by the specified .NET object.

Details and Options

  • To use ReleaseCOMObject, you first need to load .NET/Link using Needs["NETLink`"].
  • Although any COM resources will be released when the .NET object is garbage-collected, it is often desirable to force their release explicitly.
  • Each call to ReleaseCOMObject decrements the reference count on the COM resources held by the object. The resources will be freed when the reference count goes to 0 (or the .NET object is garbage-collected).
  • ReleaseCOMObject returns the new reference count on the COM resources, or a list of these counts if it was passed a list of objects.
  • ReleaseCOMObject should not be confused with ReleaseNETObject. ReleaseNETObject allows the .NET object to be garbage-collected, but does not force this to happen in a timely manner. ReleaseCOMObject can be used to force the immediate release of the COM resources held by the object.