Frequently asked question

Should I use COMReleaser or Marshal.ReleaseComObject?

Last Published: October 1, 2025
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 support with AI

Resolve your issue quickly with the Esri Support AI Chatbot.

Start chatting now

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Start chatting now

Go to download options