Resource leak in menus

Resource leak in menus

Postby Randal » Fri Jul 21, 2017 10:15 pm

All,

I recently implemented the FWH 17-02 upgrade. Started getting a lot of calls that our application was locking up, toolbar buttons losing their images, etc. I suspected a resource leak however, calling Checkres() at the close of the app does not report any problems.

I think I narrowed the problem down to menus. I use xHarbour (commercial) however, I built a sample using testmnu3.prg in the \fwh\samples folder and compiled using Harbour/Borland. When I open this sample in Windows 10 I can see the GDI count in the Windows task manager go up as I click on the menu items. Simply switching back/forth between the sample and the task manager using Alt+Tab causes the GDI count to increase, i.e. as the app simply loses/gains focus and menu is repainted the GDI count goes up. I tried this on a couple of different Win 10 machines with the same results. Interestingly, under WIndows XP neither our app or the sample increased the GDI count. The menu in our app has quite a few more menu options so it only takes a few hours of normal use before it crashes under Win 10 or Win 7.

I looked through the recent releases and did not see any reference to this being a problem or any fix.

Is this something that was addressed in a later release? Can anyone confirm this using testmnu3 sample?

Thanks,
Randal
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Resource leak in menus

Postby cnavarro » Fri Jul 21, 2017 11:10 pm

Randal

I tested for many hours my Fivedit application, with very complex menus and different fonts, since it is the application with which I test intensively all the modifications that are made and I have reviewed many times the possible loss of resources that my applications could have.
I do not find any loss of resources and neither in the subject of the menus

I tested sample
07/22/17 00:50:46: D:\FWH\SAMPLES\testmnu3.exe -- ====================================================================================================


And my FivEdit application
22/07/2017 01:06:22: D:\Fwh\FwhTeam\samples\fivedit.exe -- ====================================================================================================


Please attach your file checkres.txt and if is possible your menu ( firts lines of its function "BuildMenu", definition menu and lasts lines )
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Resource leak in menus

Postby Randal » Fri Jul 21, 2017 11:23 pm

Cristobal:

Thank you for your reply. As I mentioned the checkres does not report anything.

07/21/17 18:21:47: \\RDFXPVM\spcs\testmnu3.exe -- ====================================================================================================

You have to open the application and then use the Windows 10 task manager to monitor the GDI count. In my case, the GDI count keeps increasing however, when you close the app checkres reports nothing. The menu in our app is very long however, I was able to recreate the problem using the testmnu3 sample.

I thought perhaps it was something in xHarbour or some other libs I'm linking however, the sample was built using Harbour/Borland. Prior to this I was using FWH 13-02 which does not exhibit this behavior.

What could I be doing wrong?

Thanks,
Randal





cnavarro wrote:Randal

I tested for many hours my Fivedit application, with very complex menus and different fonts, since it is the application with which I test intensively all the modifications that are made and I have reviewed many times the possible loss of resources that my applications could have.
I do not find any loss of resources and neither in the subject of the menus

I tested sample
07/22/17 00:50:46: D:\FWH\SAMPLES\testmnu3.exe -- ====================================================================================================


And my FivEdit application
22/07/2017 01:06:22: D:\Fwh\FwhTeam\samples\fivedit.exe -- ====================================================================================================


Please attach your file checkres.txt and if is possible your menu ( firts lines of its function "BuildMenu", definition menu and lasts lines )
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Resource leak in menus

Postby cnavarro » Fri Jul 21, 2017 11:35 pm

Randal,
You use brush in the menus, or images in the main menu items?

Anyway, I'm going to review it again
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Resource leak in menus

Postby Randal » Fri Jul 21, 2017 11:45 pm

cnavarro wrote:Randal,
You use brush in the menus, or images in the main menu items?

Anyway, I'm going to review it again


Cristobal:

Thank you again for taking the time. I do not use any brushes or images in our menus and neither does the testmnu3.prg sample.

If you could please test the testmnu3 sample in the way I described using Windows task manager I'm sure you could quickly confirm whether you are experiencing the same behavior.

Thanks,
Randal
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Resource leak in menus

Postby cnavarro » Fri Jul 21, 2017 11:49 pm

Please paste image of Task Manager
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Resource leak in menus

Postby Randal » Sat Jul 22, 2017 12:17 am

cnavarro wrote:Please paste image of Task Manager


Cristobal:

In these 3 images you can see the GDI count increasing simply from alternating focus between the two windows.

https://postimg.org/image/t6mph07rd/

https://postimg.org/image/ppfol1f05/

https://postimg.org/image/9dh4iq76b/

It would really be great if someone could just run the testmn3 sample on their computer and tell me if they experience the same behavior, assuming they are using fwh 17-01 or higher. At least then I'd know if the problem was at my end.

Thanks again,
Randal
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Resource leak in menus

Postby cnavarro » Sat Jul 22, 2017 12:37 am

Randal, please test this sample and look Task Manager memory

Code: Select all  Expand view  RUN


// PullDown Menu sample

#include "FIVEWIN.CH"

static oWnd

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

FUNCTION Main()

//   SetResDebug( .T. )
   DEFINE WINDOW oWnd                                       ;
      TITLE "Testing"

   ACTIVATE WINDOW oWnd
//   CheckRes()

RETURN NIL

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


s it the same behavior?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Resource leak in menus

Postby Randal » Sat Jul 22, 2017 12:45 am

cnavarro wrote:Randal, please test this sample and look Task Manager memory

Code: Select all  Expand view  RUN


// PullDown Menu sample

#include "FIVEWIN.CH"

static oWnd

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

FUNCTION Main()

//   SetResDebug( .T. )
   DEFINE WINDOW oWnd                                       ;
      TITLE "Testing"

   ACTIVATE WINDOW oWnd
//   CheckRes()

RETURN NIL

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


s it the same behavior?


No, the GDI count does not increase using this sample.

Randal
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Resource leak in menus

Postby Antonio Linares » Sat Jul 22, 2017 7:30 am

A timer issue ?
regards, saludos

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

Re: Resource leak in menus

Postby Antonio Linares » Sat Jul 22, 2017 7:31 am

Lets use Spy++ to check what are those GDIs and where are they coming from
regards, saludos

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


Re: Resource leak in menus

Postby Antonio Linares » Sun Jul 23, 2017 6:46 am

We should try it with previous FWH versions to find when this bug has been introduced
regards, saludos

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

Re: Resource leak in menus

Postby James Bott » Sun Jul 23, 2017 7:26 pm

I tried testmnu3.prg with FWH 16.02/xHarbour and the GDI started at 25, then after multiple menu selections it ended up at 36 and I couldn't get it to go any higher. I also repeated the test with the same results.

I also switched between the Task Manager and testmnu3 a number of times (with one overlayed on the other) and the GDI remained at 25.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Resource leak in menus

Postby Antonio Linares » Sun Jul 23, 2017 8:34 pm

James,

Many thanks for your feedback

We are reviewing it
regards, saludos

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 91 guests