Microsoft KB Archive/108715

From BetaArchive Wiki

BUG: "Insufficient Memory" Errors When Calling FoxPro Menus

ID: Q108715



The information in this article applies to:

  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 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 query words: FoxWin 2.50 buglist2.50 buglist2.50a buglist2.50b gdi resources menu errmsg err msg gpf buglist2.60

Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: August 10, 1999
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.