FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Memory leak with MENU 2007
Posts: 103
Joined: Sat Oct 18, 2008 08:13 PM
Memory leak with MENU 2007
Posted: Sun Feb 13, 2011 12:36 AM
Hello!

Code:

Code (fw): Select all Collapse
FUNCTION MAIN()

   LOCAL oWnd

   SetResDebug()

   DEFINE WINDOW oWnd FROM 1, 1 TO 22, 75 ;
      TITLE "Test";
      MENU BuildMenu()

   ACTIVATE WINDOW oWnd

   FERASE("CHECKRES.TXT")
   CHECKRES()
   winExec("notepad .\checkres.txt")

return(0)

function BuildMenu()

   local oMenu

   MENU oMenu 2007

      MENUITEM "Item 1"

         MENU

            MENUITEM "Item 1.1"
            MENUITEM "Item 1.2"

            MENU
               MENUITEM "Item 1.2a"
               MENUITEM "Item 1.2b"
            ENDMENU

            MENUITEM "Item 1.3"

            MENU
               MENUITEM "Item 1.3a"
               MENUITEM "Item 1.3b"
            ENDMENU

         ENDMENU

   ENDMENU

return oMenu


Checkres.txt:

Code (fw): Select all Collapse
02/13/11 01:35:21: BMP,1568,TWINDOW:HANDLEEVENT(0)->_FWH(3394)->SHOWWINDOW(0)->TWINDOW:ACTIVATE(961)->MAIN(29)


With only

Code (fw): Select all Collapse
MENU oMenu


there is no problem.
Best Regards,

Ruediger Alich



---

HMG 3.1.3 | FTDN/FWH 13.12 | Harbour 3.2 | BCC/MinGW | Windows XP/Vista/7/8/10 (32/64-Bit), Wine (Linux/Mac) - started 1999 with FW, 1989 with Clipper
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Memory leak with MENU 2007
Posted: Sun Feb 13, 2011 07:23 AM

See this thread: viewtopic.php?f=3&t=20788

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Memory leak with MENU 2007
Posted: Sun Feb 13, 2011 07:49 AM

I too confirm this problem.

Mr.James
This issue was not discussed and solved in the other posting you are referring to. This is yet to be fixed.

Regards



G. N. Rao.

Hyderabad, India
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Memory leak with MENU 2007
Posted: Sun Feb 13, 2011 08:56 AM

Ruediger,

Already fixed and included for next FWH build, thanks! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Memory leak with MENU 2007
Posted: Sun Feb 13, 2011 09:00 AM

Antonio

TBTNBMP does not release fonts also,

Will the fix for this class be included in next fwh release ?

Thanks

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Memory leak with MENU 2007
Posted: Sun Feb 13, 2011 09:40 AM
Richard,

Please comment out this entire section from Class TBtnBmp Method Paint():
Code (fw): Select all Collapse
 /*
   if ::lBarBtn
      ::l2007 = ::l2007
      if ::oFont == NIL
         if ::oFont != nil
            if ::cFaceName != "Tahoma"
               DEFINE FONT oFont NAME "Tahoma" SIZE 0, -11
               ::SetFont( oFont )
            endif
            ::SetFont( ::oFont )
         else
            DEFINE FONT oFont NAME "Tahoma" SIZE 0, -11
            ::SetFont( oFont )
         endif
      else
         ::SetFont( ::oFont )
      endif
   else
      if ::oFont == nil
         ::SetFont( ::oFont )
         if ::oFont == nil .and. ! Empty( ::oWnd )
           ::SetFont( ::oFont )
         endif
      else
         ::SetFont( ::oFont )
      endif
   endif
   */

as fonts should not be created from the Paint method, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 103
Joined: Sat Oct 18, 2008 08:13 PM
Re: Memory leak with MENU 2007
Posted: Sun Feb 13, 2011 10:06 AM
Hi Antonio,

Antonio Linares wrote:
Already fixed and included for next FWH build, thanks!


No worries. Thanks for the quick help. :-)
Best Regards,

Ruediger Alich



---

HMG 3.1.3 | FTDN/FWH 13.12 | Harbour 3.2 | BCC/MinGW | Windows XP/Vista/7/8/10 (32/64-Bit), Wine (Linux/Mac) - started 1999 with FW, 1989 with Clipper
Posts: 103
Joined: Sat Oct 18, 2008 08:13 PM
Re: Memory leak with MENU 2007
Posted: Mon Feb 14, 2011 08:07 PM
Hi Antonio,

Antonio Linares wrote:Already fixed and included for next FWH build


Is it possible that the problem still exists in FWH 11.01 or maybe there is another problem?

Is still get with FWH 11.01:

Code (fw): Select all Collapse
02/14/11 21:01:59: BMP,1568,TWINDOW:HANDLEEVENT(0)->_FWH(3408)->SHOWWINDOW(0)->TWINDOW:ACTIVATE(975)->MAIN(14)


BTW... I only have the prg file without a rc/manifest file.
Best Regards,

Ruediger Alich



---

HMG 3.1.3 | FTDN/FWH 13.12 | Harbour 3.2 | BCC/MinGW | Windows XP/Vista/7/8/10 (32/64-Bit), Wine (Linux/Mac) - started 1999 with FW, 1989 with Clipper
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Memory leak with MENU 2007
Posted: Tue Mar 15, 2011 11:23 PM

Ruediger...

it's is a VERY INOFFENSIVE memory leak... this gdi object is created only one time to build 2007 menu effect... dont worry about that...

Posts: 103
Joined: Sat Oct 18, 2008 08:13 PM
Re: Memory leak with MENU 2007
Posted: Thu Mar 17, 2011 10:21 PM
Hi Daniel,

Daniel Garcia-Gil wrote:this gdi object is created only one time to build 2007 menu effect... dont worry about that...


But I am worried about, because I made more tests with FWH 11.01. And everytime a POPUP MENU is called there is 1 unreleased gdi object more. So if my customers start my app, work some hours with it and call a POPUP MENU e.g. about 100 times, there are about 100 unreleased gdi objects. This is not acceptable.

Code (fw): Select all Collapse
//----------------------------------------------------------------------------// 

FUNCTION MAIN()

   LOCAL oWnd

   SetResDebug()

   DEFINE WINDOW oWnd FROM 1, 1 TO 22, 75 ;
      TITLE "Test";
      MENU BuildMenu()

   ACTIVATE WINDOW oWnd;
         ON RIGHT CLICK ShortMainMenu(oWnd)

   FERASE("CHECKRES.TXT")
   CHECKRES()
   winExec("notepad .\checkres.txt")

return(0)

//----------------------------------------------------------------------------//

function ShortMainMenu(oWnd)

   local oMenu, aPos

   aPos := ScreenToClient( oWnd:hWnd, GetCursorPos() )

   MENU oMenu POPUP 2007

      MENUITEM "Item 1"

   ENDMENU

   activate popup oMenu of oWnd at aPos[1], aPos[2]

return oMenu

function BuildMenu()

   local oMenu

   MENU oMenu 2007

      MENUITEM "Item 1"

   ENDMENU

return oMenu

//----------------------------------------------------------------------------//


If I call the popup menu with right click e.g. 5 times, I get this:

Code (fw): Select all Collapse
03/17/11 23:14:30: BMP,1568,TWINDOW:HANDLEEVENT(0)->_FWH(3408)->SHOWWINDOW(0)->TWINDOW:ACTIVATE(975)->MAIN(17)
    
03/17/11 23:14:30: BMP,2160,TWINDOW:HANDLEEVENT(0)->_FWH(3408)->TRACKPOPUP(0)->TMENU:ACTIVATE(470)->SHORTMAINMENU(39)->(b)MAIN(17)->TWINDOW:RBUTTONDOWN(1907)->TWINDOW:HANDLEEVENT(0)->_FWH(3408)->WINRUN(0)->TWINDOW:ACTIVATE(992)->MAIN(17)
    
03/17/11 23:14:30: BMP,2532,TWINDOW:HANDLEEVENT(0)->_FWH(3408)->TRACKPOPUP(0)->TMENU:ACTIVATE(470)->SHORTMAINMENU(39)->(b)MAIN(17)->TWINDOW:RBUTTONDOWN(1907)->TWINDOW:HANDLEEVENT(0)->_FWH(3408)->WINRUN(0)->TWINDOW:ACTIVATE(992)->MAIN(17)
    
03/17/11 23:14:30: BMP,2880,TWINDOW:HANDLEEVENT(0)->_FWH(3408)->TRACKPOPUP(0)->TMENU:ACTIVATE(470)->SHORTMAINMENU(39)->(b)MAIN(17)->TWINDOW:RBUTTONDOWN(1907)->TWINDOW:HANDLEEVENT(0)->_FWH(3408)->WINRUN(0)->TWINDOW:ACTIVATE(992)->MAIN(17)
    
03/17/11 23:14:30: BMP,3140,TWINDOW:HANDLEEVENT(0)->_FWH(3408)->TRACKPOPUP(0)->TMENU:ACTIVATE(470)->SHORTMAINMENU(39)->(b)MAIN(17)->TWINDOW:RBUTTONDOWN(1907)->TWINDOW:HANDLEEVENT(0)->_FWH(3408)->WINRUN(0)->TWINDOW:ACTIVATE(992)->MAIN(17)
    
03/17/11 23:14:30: ====================================================================================================
Best Regards,

Ruediger Alich



---

HMG 3.1.3 | FTDN/FWH 13.12 | Harbour 3.2 | BCC/MinGW | Windows XP/Vista/7/8/10 (32/64-Bit), Wine (Linux/Mac) - started 1999 with FW, 1989 with Clipper
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Memory leak with MENU 2007
Posted: Fri Mar 18, 2011 12:07 AM

Yes...

we will fix soon

thanks for feedback

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Memory leak with MENU 2007
Posted: Mon Mar 28, 2011 11:18 AM

Ruediger,

Do you get the same without using 2007 in the popup menu creation ? thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Memory leak with MENU 2007
Posted: Mon Mar 28, 2011 11:40 AM

Yes, it is the 2007 clause...

searching...

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Memory leak with MENU 2007
Posted: Mon Mar 28, 2011 11:53 AM
  • Fix: Clause 2007 was releasing a bitmap but not removing it from the FWH list. Now it is ok.
    (still a pending one there). FWH 11.03
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion