Memory leak with MENU 2007

Post Reply
User avatar
IBTC
Posts: 103
Joined: Sat Oct 18, 2008 8:13 pm
Location: Stuttgart, Germany
Contact:

Memory leak with MENU 2007

Post by IBTC »

Hello!

Code:

Code: Select all

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: Select all

02/13/11 01:35:21: BMP,1568,TWINDOW:HANDLEEVENT(0)->_FWH(3394)->SHOWWINDOW(0)->TWINDOW:ACTIVATE(961)->MAIN(29)
 
With only

Code: Select all

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Memory leak with MENU 2007

Post by James Bott »

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Memory leak with MENU 2007

Post by nageswaragunupudi »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Memory leak with MENU 2007

Post by Antonio Linares »

Ruediger,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: Memory leak with MENU 2007

Post by Richard Chidiak »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Memory leak with MENU 2007

Post by Antonio Linares »

Richard,

Please comment out this entire section from Class TBtnBmp Method Paint():

Code: Select all

 /*
   if ::lBarBtn
      ::l2007 = ::oWnd:l2007
      if ::oFont == NIL
         if ::oWnd:oFont != nil
            if ::oWnd:oFont:cFaceName != "Tahoma"
               DEFINE FONT oFont NAME "Tahoma" SIZE 0, -11
               ::oWnd:SetFont( oFont )
            endif
            ::SetFont( ::oWnd:oFont )
         else
            DEFINE FONT oFont NAME "Tahoma" SIZE 0, -11
            ::SetFont( oFont )
         endif
      else
         ::oWnd:SetFont( ::oFont )
      endif
   else
      if ::oFont == nil
         ::SetFont( ::oWnd:oFont )
         if ::oFont == nil .and. ! Empty( ::oWnd )
           ::SetFont( ::oWnd:oWnd: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
User avatar
IBTC
Posts: 103
Joined: Sat Oct 18, 2008 8:13 pm
Location: Stuttgart, Germany
Contact:

Re: Memory leak with MENU 2007

Post by IBTC »

Hi Antonio,
Antonio Linares wrote: Already fixed and included for next FWH build, thanks!
No worries. Thanks for the quick help. :D
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
User avatar
IBTC
Posts: 103
Joined: Sat Oct 18, 2008 8:13 pm
Location: Stuttgart, Germany
Contact:

Re: Memory leak with MENU 2007

Post by IBTC »

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: Select all

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
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Memory leak with MENU 2007

Post by Daniel Garcia-Gil »

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...
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
IBTC
Posts: 103
Joined: Sat Oct 18, 2008 8:13 pm
Location: Stuttgart, Germany
Contact:

Re: Memory leak with MENU 2007

Post by IBTC »

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: Select all

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

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: Select all

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
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Memory leak with MENU 2007

Post by Daniel Garcia-Gil »

Yes...

we will fix soon


thanks for feedback
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Memory leak with MENU 2007

Post by Antonio Linares »

Ruediger,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Memory leak with MENU 2007

Post by Antonio Linares »

Yes, it is the 2007 clause...

searching...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Memory leak with MENU 2007

Post by Antonio Linares »

* 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
Post Reply