Each instance of an OleAutomationObject has some operating system resources associated with it that must be freed when they are no longer required. Hence, when an OLE automation controller is finished using these objects, it must release those resources. The
OleAutomationObject instance method
releaseObject performs this function. For example, in the previous example the three Microsoft Excel OLE automation objects should be released immediately after the
Quit method is invoked:
After the releaseObject message is sent, the
OleAutomationObject is no longer connected to the OLE automation server and, as such, it cannot be used. To connect back to the same server, a new instance of
OleAutomationObject must be created. After a
releaseObject message is sent, it is good practice to assign
nil values to all Smalltalk variables that were referencing the
OleAutomationObject.