User Guide

ReleaseComObject 657
ReleaseComObject
Description
Releases a COM Object and frees up resources that it used.
Returns
Nothing.
Category
Extensibility functions
Function syntax
ReleaseComObject(objectName)
See also
CreateObject, cfobject
History
ColdFusion MX 6.1: Added this function.
Parameters
Usage
This function forcefully terminates and releases the specified COM object and all COM objects
that it created. Use this function when the object is no longer in use, to quickly free up resources.
If the COM object has a method, such as a
quit method, that terminates the program, call this
method before you call the
ReleaseComObject function.
This function can improve processing efficiency, but is not required for an application to work. If
you do not use this function, the Java garbage collection mechanism eventually frees the
resources. If you use this function on an object that is in use, the object is prematurely released
and your application will get exceptions.
Example
<h3>ReleaseComObject Example</h3>
<cfscript>
obj = CreateObject("Com", "excel.application.9");
//code that uses the object goes here
obj.quit();
ReleaseObject(obj);
</cfscript>
Parameter Description
objectName Variable name of a COM object that was created using the
CreateObject function
or
cfobject tag.