Frequently asked question

Should I use COMReleaser or Marshal.ReleaseComObject?

Last Published: April 25, 2020

Answer

This article addresses the use of COM objects in .NET code and the appropriate way to dispose of these COM object references.

In .NET code, references to COM objects are held by way of runtime callable wrappers (RCWs). There are two classes used to release the COM object references in .NET code: COMReleaser or Marshall.ReleaseComObject. The COMReleaser class is the recommended method in most situations, because internally it calls the System.Runtime.InteropServices.Marshall.ReleaseCOMObject, which ensures that all COM object references are terminated.

For additional information, please see the help documentation in the Related Information section on how to release COM References.

Article ID:000009974

Software:
  • ArcGIS Engine

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic