BUG: "Insufficient Memory" Errors When Calling FoxPro Menus

Last reviewed: June 27, 1995
Article ID: Q108715
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, and 2.6

SYMPTOMS

You receive several "Insufficient Memory" errors and eventually a general protection (GP) fault when you are calling multiple FoxPro menus created with DEFINE MENU under Microsoft Windows version 3.1 or Microsoft Windows for Workgroups version 3.11.

NOTE: This problem does not occur under Windows NT.

CAUSE

ACTIVATE MENU <menuname> uses Window's graphics device interface (GDI) resources. If these resources are not released with a RELEASE MENU <menuname> command, an "Insufficient Memory" error or GP fault may occur. There is no set number of ACTIVATE MENU commands that will cause an "Insufficient Memory" error message.

RESOLUTION

To avoid this problem, do one of the following:

  • Use the RELEASE MENU <menuname> command to release the menu from memory and release the system resources.

    -or-

  • Redefine the FoxPro system menu instead of using the DEFINE MENU, ACTIVATE MENU, DEACTIVATE MENU, and RELEASE MENU commands.

STATUS

Microsoft has confirmed this to be a problem in FoxPro versions 2.5, 2.5a, 2.5b, and 2.6 for Windows. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

  1. Run the following program:

          FOR MENUS =1 TO 10
    
             WAIT WINDOW "activating menu # " + LTRIM(STR(MENUS)) NOWAIT
             menuname = "menus" + LTRIM(STR(MENUS))
             DEFINE MENU (menuname)
    
             FOR pads = 1 TO 20
                  padname = "pads" + LTRIM(STR(pads))
                  popname = "pop" + LTRIM(STR(pads))
                  DEFINE PAD (padname) OF (menuname) PROMPT padname
                  DEFINE POPUP (popname)
    
                  FOR bars = 1 TO 20
                       barname = "bars" + LTRIM(STR(bars))
                       DEFINE BAR bars OF (popname) PROMPT barname
                  ENDFOR
             ENDFOR
             ACTIVATE MENU (menuname) NOWAIT
          ENDFOR
    
       You will get an "Insufficient memory" error message. Note that GDI
       memory has been exhausted.
    
    

  2. In the Command window, issue the following command:

          RELEASE MENU ALL
    

    The "Insufficient memory" error message appears again.

  3. Issue the RELEASE MENU ALL command again. FoxPro will cause a GP fault.


Additional reference words: FoxWin 2.50 2.50a 2.50b buglist2.50
buglist2.50a
buglist2.50b gdi resources menu errmsg err msg gpf buglist2.60 2.60
KBCategory: kbenv kbprg kbbuglist
KBSubcategory: FxenvMemory


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: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.