FIX: GPF/UAE with Huge Array Size as Multiple of 64K Bytes

Last reviewed: October 30, 1997
Article ID: Q98990
2.00 WINDOWS kbenv kbbuglist

The information in this article applies to:

- Standard and professional editions of Microsoft Visual Basic programming

  system for Windows, version 2.0

SYMPTOMS

A general protection (GP) fault or Unrecoverable Application Error (UAE) may result when you define a huge array using DIM, REDIM, or GLOBAL and specify a size that's a multiple of 64K.

CAUSE

Huge arrays that cause a GP fault or UAE are a(n), where n is 4094 + 4095*i for i = 1 to 7 (assuming 16-byte element sizes). The problem occurs when the array plus its overhead fills a space of 128K and each increment of 64K exactly.

WORKAROUND

To work around the problem, add or subtract one element in the array.

STATUS

Microsoft has confirmed this to be a bug in Microsoft Visual Basic version 2.0 for Windows. This bug was corrected in Microsoft Visual Basic version 3.0 for Windows.

MORE INFORMATION

Steps to Reproduce the Problem

1. Start Visual Basic, or if Visual Basic is already running, choose New
   Project from the File menu (ALT, F, N).

  • Add the following code to the Form_Click event procedure of Form1:

    Form_Click ()

           ReDim A(32759) As Variant
    
       End Sub
    
    

  • From the Run menu, choose Start (ALT, R, S).

    At this point, a GP fault or UAE occurs. The GP fault address is 0001:0CA2.


  • Additional reference words: buglist2.00 fixlist3.00 2.00
    KBCategory: kbenv kbbuglist
    KBSubcategory: EnvtRun
    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.