FIX: GPF/UAE When Create or Use Huge Array w/ Large Elements
ID: Q95290
|
The information in this article applies to:
-
Microsoft Visual Basic programming system for Windows, version 2.0
SYMPTOMS
A general protection (GP) fault or unrecoverable application error (UAE)
may occur when you try to run or compile a program if an array meets all
of the following criteria:
- It is a huge array (greater then 64k in total size).
- The size of the array elements are large (usually 512 bytes or
greater). This will usually occur only when the array elements
are user-defined type variables.
- An array element contains either one or more variant or variable
length string variables.
WORKAROUND
To work around the problem, change the element size of the array elements.
In general, the smaller the element size, the less likely the problem.
STATUS
Microsoft has confirmed this to be a problem in Microsoft Visual Basic
version 2.0 for Windows. This problem was corrected in Microsoft Visual
Basic version 3.0 for Windows.
MORE INFORMATION
Steps to Reproduce Problem
- Start VB.EXE.
- From the File menu, choose New Module (the default is Module1.BAS).
- Add the following code to Module1.BAS:
Type MyType
va(1200) As Variant
End Sub
Dim ma(20) As MyType
- Press the F5 key to run the code. Then from the Run menu, choose End. At
this point a GP fault or UAE may occur.
- Change the array 'va(1200) As Variant' to 'va(1200) As String'. Note
that because String variables are 6 bytes and Variants are 16 bytes,
this change reduces the size of the user-defined type and therefore
reduces the element size of the array.
- Press the F5 key to run the code. Then from the Run menu, choose End.
Because you reduced the element size of the array, you may not encounter
a GP fault or UAE this time.
Additional query words:
buglist2.00 fixlist3.00 2.00 3.00
Keywords :
Version :
Platform :
Issue type :