FIX: Nesting OLE Automation Calls Causes GP FaultLast reviewed: October 30, 1997Article ID: Q114000 |
3.00
WINDOWS
kbole kbbuglist
The information in this article applies to: - Standard and Professional Editions of Microsoft Visual Basic for Windows, version 3.0
SYMPTOMSNesting multiple OLE Automation property accesses and/or method invocations within the same procedure may lead to temporary memory loss or a general protection (GP) fault.
CAUSEWhen Visual Basic makes the cross process calls to perform the property access or method invocation it does not release the temporary space allocated until the procedure completes execution.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been corrected in Visual Basic version 4.0.
MORE INFORMATION
Multiple IDispatch Calls Use Up MemoryIn order to access a property or execute a method on a OLE Automation object, automation controllers (such as Visual Basic) make IDispatch calls to the server application. Each time a IDispatch call is made, Visual Basic creates a temporary variable referencing the object. Visual Basic version 3.0 does not release the memory for these temporary variables until the procedure in which the property access or method invocation resides completes execution. Therefore, if you have multiple property accesses or method invocations within the same procedure, the amount of free memory steadily decreases until the procedure completes execution. Nesting multiple OLE Automation statements that require IDispatch calls within the same procedure can produce a GP fault in module VBOA300.DLL at 0001:0D03. It could be useful to estimate the number of IDispatch calls Visual Basic makes. The number of IDispatch calls Visual Basic executes for an individual statement is directly related to the number of properties or methods that are combined by using the dot notation to perform the statement. Thus a good rule of thumb is to count the number of "dots" in the statement. For example, the following statement makes two IDispatch calls:
oXLSheet.Range("A1").Value = "Price"Depending on how you access a collection, there will also be implicit IDispatch calls. For example, if you access a collection without the Item method, it is implicitly called. The following statement makes five IDispatch calls - three explicit "dots" and two implicit calls to the Item method:
oXLApp.Workbooks(1).Sheets(1).Range("A1").Value = "Price" Steps to Reproduce Problem
|
Additional reference words: buglist3.00 3.00 GPF MemLeak fixlist4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |