FIX: GPF/UAE When Create or Use Huge Array w/ Large Elements

Last reviewed: October 30, 1997
Article ID: Q95290
2.00 WINDOWS kbprg kbbuglist

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

  1. Start VB.EXE.

  2. From the File menu, choose New Module (the default is Module1.BAS).

  3. Add the following code to Module1.BAS:

    Type MyType

          va(1200) As Variant
    
       End Sub
       Dim ma(20) As MyType
    
    

  4. 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.

  5. 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.

  6. 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 reference words: buglist2.00 fixlist3.00 2.00 3.00
KBCategory: kbprg kbbuglist
KBSubcategory: PrgOther
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.