ID: Q164494
The information in this article applies to:
When hosting version 1.0 of VBScript or JScript using the ActiveX Scripting interfaces, dispatch objects are not released immediately by the scripting engine.
For example, in the following VBScript code the dispatch object for X is not be released when X is set to 0:
Set X = HostObject.HostDispatchObject
X = 0
The version 1.0 VBScript and JScript engines use a deferred garbage collection scheme to release dispatch object pointers. In the example above, X is freed eventually by the engine. Version 1.0 of VBScript and JScript free temporary objects and release dispatch pointers after 8192 temporary variants or 128K of strings have been allocated.
If necessary, the following line of VBScript forces an immediate garbage collection:
Y = len(string(65537, 'x'))
This script line fills up a temporary string larger than 128K, which
causes garbage collection to start. The temporary string is not stored;
if it were, the string contents would not be freed until the
aforementioned conditions are met and the next garbage collection is
performed.
For information on hosting VBScript or JScript in an application, refer to the ActiveX SDK documentation, which is available at the following Web site:
http://www.microsoft.com/intdev/sdk
It is also available at the VBSCript and JScript Web sites:
http://www.microsoft.com/scripting/vbscript
http://www.microsoft.com/scripting/jscript
Keywords : kbprg AXSDKScripting
Version : 1.00 1.10
Platform : WINDOWS
Last Reviewed: July 2, 1999