PRB: RELEASE May Not Remove OLE Objects from Memory (138398)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
This article was previously published under Q138398 SYMPTOMS
After creating an OLE object using the CREATEOBEJCT() function, releasing
that object does not remove the OLE application session from memory.
RESOLUTION
For Visual FoxPro to remove certain OLE application session objects from
memory, the OLE application must be terminated. For example, after running
the following code, three instances of Microsoft Excel remain in memory:
FOR i = 1 TO 3
oObject = CREATEOBJECT('Excel.Application')
RELEASE oObject
ENDFOR
To end each Microsoft Excel session before reentering the FOR loop, the
Microsoft Excel session must first be terminated. For example:
FOR i = 1 TO 3
oObject = CREATEOBJECT('Excel.Application')
oObject.Quit
RELEASE oObject
ENDFOR
In this example, Microsoft Excel is told to quit, and then the code
releases the memory variable in Visual FoxPro by using the oObject.Release
command. Quit is a method that Microsoft Excel recognizes and can act upon,
the actual method for your OLE automation application may differ.
STATUS
This behavior is by design.
Modification Type: | Minor | Last Reviewed: | 3/14/2005 |
---|
Keywords: | kbprb KB138398 |
---|
|