Showing posts with label COM Components. Show all posts
Showing posts with label COM Components. Show all posts

How Do I Release COM objects?

Runtime Callable Wrapper is managed  hence its lifetime is controlled by Common Language Runtime. The COM component is freed from memory when the garbage collector calls the Finalize() method on RCW. Internally, RCW calls Release() of IUknown interface on the COM object.

To explicitly remove COM objects from memory, invoke the static method on Marshal class in System.Runtime.InteropServices namespace:

using System.Runtime.InteropServices;

Marshal.ReleaseComObject(myAuthorRCW);

What is Type Library Importer (Tlbimp.exe) ?

The Type Library Importer or Tlbimp.exe is used to convert type definitions within COM component to equivalent definitions in CLR assembly. The output of Tlbimp.exe is a binary file (an assembly) that contains runtime metadata for the types defined within the original type library. You can examine this file with tools such as Ildasm.exe.

Popular Posts