INFO: VBScript and JScript Do Not Release Host Dispatch ObjectsLast reviewed: September 30, 1997Article ID: Q164494 |
The information in this article applies to:
SUMMARYWhen 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 MORE INFORMATIONThe 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.
REFERENCESFor 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/sdkIt is also available at the VBSCript and JScript Web sites:
http://www.microsoft.com/vbscript http://www.microsoft.com/jscript Keywords : AXSDKSripting kbprg Version : 1.00 1.10 Platform : WINDOWS |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |