BUG: "Insufficient Memory" Errors When Calling FoxPro Menus

ID: Q108715

The information in this article applies to:

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:

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

Last Reviewed: June 27, 1995