Resource leak in menus

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

Resource leak in menus

Post by Randal »

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
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Resource leak in menus

Post by cnavarro »

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 )
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Randal
Posts: 250
Joined: Mon Oct 24, 2005 8:04 pm

Re: Resource leak in menus

Post by Randal »

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 )
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Resource leak in menus

Post by cnavarro »

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

Anyway, I'm going to review it again
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Randal
Posts: 250
Joined: Mon Oct 24, 2005 8:04 pm

Re: Resource leak in menus

Post by Randal »

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
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Resource leak in menus

Post by cnavarro »

Please paste image of Task Manager
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Randal
Posts: 250
Joined: Mon Oct 24, 2005 8:04 pm

Re: Resource leak in menus

Post by Randal »

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
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Resource leak in menus

Post by cnavarro »

Randal, please test this sample and look Task Manager memory

Code: Select all


// 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?
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Randal
Posts: 250
Joined: Mon Oct 24, 2005 8:04 pm

Re: Resource leak in menus

Post by Randal »

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

Code: Select all


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

Re: Resource leak in menus

Post by Antonio Linares »

A timer issue ?
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: Resource leak in menus

Post by Antonio Linares »

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: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Resource leak in menus

Post by Antonio Linares »

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

Re: Resource leak in menus

Post by James Bott »

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

Re: Resource leak in menus

Post by Antonio Linares »

James,

Many thanks for your feedback

We are reviewing it
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply