FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Reduced Memory after VTitle-Dialog-Switch ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Reduced Memory after VTitle-Dialog-Switch ?
Posted: Wed Nov 04, 2009 01:30 AM
Hello,

testing the new VTitle Painter, I noticed a reduced Memory
after switching between 2 Dialog-Previews. After 15 Switches, there is a Memory-Problem
I included a Memory-display to control the Values.
Is it possible, something from the VTitle stays in Memory ?
I used SYSREFRESH after closing Dialog 1 and reopen Dialog 2, but it doesn't help

I start with a free Memory of : 1146412


I open the Painter and choose Preview or Project-Skip
The VTitle-Dialog includes only Buttons ( BMP's )


After Closing the VTitle-Preview-Dialog, the Memory is reduced to : 1122900
Each reopen of the VTitle-Dialog reduces the Memory.




A Window with a Start-Button for the VTitle-Dialog :
Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "TTitle.ch"
#include "Image.ch"

static oWnd, oButtFont

FUNCTION Main()
LOCAL oBtn1, oBtn2, hDC, oBrush, oImage
LOCAL nWidth := GetSysMetrics(0)
LOCAL nHeight := GetSysMetrics(1)

SET _3DLOOK ON
SetBalloon( .T. )
c_path := CURDRIVE() + ":\" + GETCURDIR()
oProgFont := TFont():New("Arial", ,-14,.F.,.F. , , , ,.F. ) 

DEFINE WINDOW  oWnd  TITLE "VTitle Test" 

oButtFont := TFont():New("Arial",0,-16,.F.,.T.,0,0,0,.T. ) 
DEFINE IMAGE oImage FILENAME c_path + "\Images\BACKGRD.JPG" 

@ nHeight - 160, nWidth - 420 BTNBMP oBtn1 SIZE 200, 60 OF oWnd  2007 ;
FILENAME c_path + "\Images\select.bmp" ;
LEFT ;
PROMPT "  &Preview VTitle " ; 
FONT oButtFont ;
ACTION Tools(oWnd)
oBtn1:lTransparent = .t. 
oBtn1:cTooltip :=  { "Open" + CRLF + ;
       "the VTitlt-Painter","VTitle-Painter", 1, CLR_BLACK, 14089979 }

@ nHeight - 160, nWidth - 200 BTNBMP oBtn2 SIZE 150, 60 OF oWnd  2007 ;
FILENAME c_path + "\Images\exit.bmp" ;
LEFT ;
PROMPT "  &Exit  " ;
FONT oButtFont ;
ACTION oWnd:End()
oBtn2:lTransparent = .t.
oBtn2:cTooltip :=  { "Close" + CRLF + ;
        "the VTitle-Painter","Close Window", 1, CLR_BLACK, 14089979 }

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON PAINT ( DRAWBITMAP( hdc, oImage:hbitmap, 0, 0, nWidth, nHeight ) ) ;
VALID MsgYesNo( "Do you want to end?" )

RETURN( NIL )

// -------------  DIALOG --------------------------------

FUNCTION Tools(oWnd)
LOCAL oDlg, oBtn1, oTextFont, oBrush

DEFINE DIALOG oDlg RESOURCE "VTitle" OF oWnd TRANSPARENT ;
TITLE  "VTitle-Test" FONT oProgFont 

REDEFINE BTNBMP oBtn1 ID 70 OF oDlg  2007 ;
FILENAME c_path + "\Images\exit.bmp" ;
LEFT ;
PROMPT "  &Exit  " ;
FONT oProgFont ;
ACTION ( oDlg:End(), oWnd:End() )
oBtn1:lTransparent = .t.
oBtn1:cTooltip :=  { "Close" + CRLF + ;
"the VTitle-Test","Close Test", 1, CLR_BLACK, 14089979 }


oTextFont := TFont():New( "Arial",27,-47,.F.,.T.,0,0,0,.T.)

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT SHOW_TITLE(oDlg,oTextFont,oBrush) ;
ON PAINT D_GRAD( oDlg, hDC ) ;

oBrush:End()
oTextFont:End()

RETURN NIL

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

STATIC FUNCTION D_GRAD( oDlg, hDC ) 
LOCAL aGrad := { { 0.20, 8388608, 16777215 }, ;
 { 0.20, 16777215, 8388608 } }
GradientFill( hDC,  0, 0, oDlg:nHeight, oDlg:nWidth, aGrad, .T. )

RETURN NIL

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

FUNCTION  SHOW_TITLE(oDlg,oTextFont,oBrush)
LOCAL oBar
LOCAL nSCR1 := oDlg:nWidth()  // Screen-Width
LOCAL nSCR2 := oDlg:nHeight()  // Screen-Hight - Title-Height

@  100,100 TITLE oBar SIZE 496,268 of oDlg SHADOW BOTTOMRIGHT SHADOWSIZE 25

oBar:aGrdBack := { { 0.87,8388608,16777215 }, ;
          { 0.87,16777215,8388608 } }

oBar:nClrLine1 := 8388608
oBar:nClrLine2 := 128

oBar:lRound := .T.

@  181,276 TITLETEXT OF oBar TEXT "Logo" FONT oTextFont  COLOR  8388608 SHADOW BOTTOMRIGHT

@  0, 0 TITLEIMG OF oBar BITMAP "E:\T_VTITLE_T\IMAGES\__Deco1.bmp" TRANSPARENT
@  20, 280 TITLEIMG OF oBar BITMAP "E:\T_VTITLE\IMAGES\Delete.bmp" REFLEX TRANSPARENT ANIMA LEVEL 255;
ACTION MsgAlert( "Button with Action","Attention" )
@  20, 360 TITLEIMG OF oBar BITMAP "E:\T_VTITLE\IMAGES\Preview.bmp" REFLEX TRANSPARENT ANIMA LEVEL 255;
ACTION MsgAlert( "Button with Action","Attention" )
@  100, 280 TITLEIMG OF oBar BITMAP "E:\T_VTITLE\IMAGES\Select.bmp" REFLEX TRANSPARENT ANIMA LEVEL 255;
ACTION MsgAlert( "Button with Action","Attention" )
@  100, 360 TITLEIMG OF oBar BITMAP "E:\T_VTITLE_T\IMAGES\user.bmp" SIZE 150, 0 REFLEX TRANSPARENT ANIMA LEVEL 255;
ACTION MsgAlert( "Button with Action","Attention" )

RETURN NIL


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Wed Nov 04, 2009 02:00 AM

Uwe,

If that is free memory you are showing then it seems to have gone up not down.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Wed Nov 04, 2009 09:38 AM

Uwe,

You can use FWH SetResDebug() and CheckRes() to check if the application is loosing GDI memory:

viewtopic.php?f=3t=15935start=0hilit=setresdebug

&&&

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Thu Nov 05, 2009 12:37 AM
Antonio,

I included two Buttons, Your Function and the Memory-Test to the VTitle-Preview.
Do I have to check the Resource-Values after changing to another VTitle-Preview ?
If yes, I can save the old values and show them after a new Preview next to the new ones.
That makes it better for testing.





Best Regards
Uwe :-)
[
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Thu Nov 05, 2009 07:33 AM

Uwe,

Yes, GDI consume should be checked once those GDI objects are no longer in use, so they should not be in the list.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Thu Nov 05, 2009 03:30 PM
Antonio,

thank You very much for the help.

Now I have a Line- and Preview-Counter with two xBrowser.
I seems, the VTitle-BMP's are not released ?
These Lines ( 5 ) are still activated from inside Function SHOW_TITLE() , after closing the VTitle-Preview :
@ aPICTURES2[I][4], aPICTURES2[I][5] TITLEIMG OF oBar1 BITMAP aPICTURES2[I][3] TRANSPARENT

The first Browser-Array is only filled once at Start. A VTitle-Preview fills the Array for xBrowse 2.



After 5 VTitle-Previews the BMP's are still included in the List.





The PRG-Structure, how I create the VTtitles :

Code (fw): Select all Collapse
FUNCTION NEW_TITLE()
...
...
...
// The Vtitle Body and Text is created
...

// The 10 possible BMP's

I := 1
FOR I := 1 TO 10     
   xxx := LTRIM(STR(I))
   IF aPICTURES2[I][9] = 0 // no BMP-Resize
      // F F F / T
      IF aPICTURES2[I][6] = .F. .and. aPICTURES2[I][7] = .F. .and. aPICTURES2[I][8] = .F. 
          @  aPICTURES2[I][4], aPICTURES2[I][5] TITLEIMG OF oBar1 BITMAP aPICTURES2[I][3] TRANSPARENT   
      ENDIF
      ....
      ....
   ELSE
      ...
      ...
   ENDIF
NEXT

ACTIVATE DIALOG oDlg CENTERED    

IF B_BRUSHT = 2
   oBrush2:end()
ENDIF

RETURN( NIL )


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Thu Nov 05, 2009 06:33 PM

Uwe,

In Class TTltle Method Destroy(), this code:

return Super:Destroy()

should be called instead of:

return nil

Anyhow I appreciate if you run your tests again to see if we still have some GDI objects to clean, thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Thu Nov 05, 2009 08:27 PM

Hi,

I just want to learn what is this informations.

Should the list same (len(aResources)) after the procedure return?

There are several 0 resources in array. What does it mean?. After my procedure always increase this 0 resources. Is this normal?

Thanks,

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Thu Nov 05, 2009 10:09 PM
Antonio,

I changed the RETURN but the Problem still exists.

Horizon,

Step by Step :

I noticed, that the speed reduced after opening a VTitle-Preview after 15 - 20 times.
After that a Crash.
I started wit 470 Entries. 1. Preview 475 ( 5 BMP's ), 2. Preview 480 (10 BMP's ) =>>>
I added a Test to the Application and included Line-Numbers to the Resource-List.

1. I included a Button to show a list of existing Resources :


2. I open the List from Dialog-level without a Preview :


3. Next I open the 1. Preview :


4. I open the Resource-List to look for Lines of the Preview-Dialog
The Resource of the 5 Bitmaps are still included ( not released )


5. Once again I open a Preview and after closing the Dialog, I look for existing PRG-Lines inside the List.
The 5 Bitmaps are added twice now.


You can image, after 20 times, there will be a Crash.
I hope it is a Help for You, to explain the Problem.

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Fri Nov 06, 2009 12:04 AM
Uwe,

Lets try to use a small example to check it. This example works fine and shows no unreleased GDI objects:
Code (fw): Select all Collapse
#include "fivewin.ch"
#include "ttitle.ch"

Function main()

    local oWnd, oTitle1, oFont1
    
    SetResDebug()
    
    DEFINE FONT oFont1 NAME "Blackoak Std" size 30, 60      

    DEFINE WINDOW oWnd
    
    @ 015, 30 TITLE oTitle1 size 460, 60 of oWnd SHADOW TOPRIGHT 
    
    oTitle1:aGrdBack = { { 1, nRGB( 129, 130, 138 ), nRGB( 59, 60, 62 ) } }
    oTitle1:nShadowIntensity = 70
    
    @  10, 10 TITLETEXT OF oTitle1 TEXT "A Title" FONT oFont1

    ACTIVATE WINDOW oWnd
    
    oFont1:End()
    
    CheckRes()
    
    MsgInfo( MemoRead( "checkres.txt" ) )

return nil

Please try to modify it to get unreleased GDI objects, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Fri Nov 06, 2009 07:56 AM

:?

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Fri Nov 06, 2009 11:36 AM
Antonio,

I used Your Test.prg and added the Lines, to get the same Structure like the Tool-Application.
Two BMP's are added to the VTitle. All Dialogs are from Code ( no resources used ) :

1. The Mainwindow
2. A Button to open the Dialog
3. A Button for the Preview inside the Dialog
In all Dialogs, a Res.-Check is included.



Resources-Check


Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "xBrowse.ch"
#include "Image.ch"
#include "ttitle.ch"

static oWnd, hDC
static aResources := {}, nCounter := 0

Function main()
local oFont1, oTitle1, oBtn1, oBtn2, oBtn3
local nWidth := GetSysMetrics(0)
local nHeight := GetSysMetrics(1)   
local c_path := CURDRIVE() + ":\" + GETCURDIR() 

SetResDebug()
    
DEFINE FONT oFont1 NAME "Blackoak Std" size 30, 60      

DEFINE WINDOW oWnd
    
@ 015, 30 TITLE oTitle1 size 460, 100 of oWnd SHADOW TOPRIGHT 
    
oTitle1:aGrdBack = { { 1, nRGB( 129, 130, 138 ), nRGB( 59, 60, 62 ) } }
oTitle1:nShadowIntensity = 70
    
@  10, 10 TITLETEXT OF oTitle1 TEXT "A Title" FONT oFont1
@  15, 250  TITLEIMG OF oTitle1 BITMAP c_path + "\Images\save.bmp" TRANSPARENT   
@  15, 300 TITLEIMG OF oTitle1 BITMAP c_path + "\Images\exit.bmp" TRANSPARENT   

@ nHeight - 290, 790 BTNBMP oBtn1 SIZE 230, 60 OF oWnd  2007 ;
FILENAME c_path + "\Images\save.bmp" ;
LEFT ;
PROMPT " &Load Dialog " ;
ACTION ( TEST(c_path) ) 

oBtn1:lTransparent = .t.   
oBtn1:cTooltip :=  { "Load" + CRLF + ;
                                  "the Test-Dialog","Load Dialog", 1, CLR_BLACK, 14089979 }

@ nHeight - 220, 790 BTNBMP oBtn2 SIZE 230, 60 OF oWnd  2007 ;
FILENAME c_path + "\Images\save.bmp" ;
LEFT ;
PROMPT " &Check Resources " ;
ACTION (  CheckRes2(c_path) )

*ACTION (  CheckRes(), ;
*   MsgInfo( MemoRead( "checkres.txt" ) ) ) 

oBtn2:lTransparent = .t.   
oBtn2:cTooltip :=  { "Save" + CRLF + ;
                                  "the working Project","Save Project", 1, CLR_BLACK, 14089979 }

@ nHeight - 150, 790 BTNBMP oBtn3 SIZE 230, 60 OF oWnd  2007 ;
FILENAME c_path + "\Images\exit.bmp" ;
LEFT ;
PROMPT "  &Exit Test" ;
ACTION ( oWnd:End() )

oBtn3:lTransparent = .t.   
oBtn3:cTooltip :=  { "Close" + CRLF + ;
  "the Resource-Test","Close Window", 1, CLR_BLACK, 14089979 }

ACTIVATE WINDOW oWnd MAXIMIZED 

oFont1:End()
    
return nil

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

FUNCTION TEST(c_path)
Local oDlg, oTitle2, oBtn4, oBtn5, oFont2

DEFINE FONT oFont2 NAME "Blackoak Std" size 30, 60      

DEFINE DIALOG oDlg FROM 0, 0 TO 300, 500 PIXEL ;
TITLE "VTitle-Test 1"

@ 15, 20 TITLE oTitle2 size 200, 80 of oDlg SHADOW TOPRIGHT 
    
oTitle2:aGrdBack = { { 1, nRGB( 129, 130, 138 ), nRGB( 59, 60, 62 ) } }
oTitle2:nShadowIntensity = 70
    
@  10, 10 TITLETEXT OF oTitle2 TEXT "A Title" FONT oFont2
@  15, 250  TITLEIMG OF oTitle2 BITMAP c_path + "\Images\save.bmp" TRANSPARENT   
@  15, 300 TITLEIMG OF oTitle2 BITMAP c_path + "\Images\exit.bmp" TRANSPARENT   

@ 120, 20 BTNBMP oBtn4 SIZE 60, 25 OF oDlg  2007 ;
FILENAME c_path + "\Images\save.bmp" ;
LEFT ;
PROMPT " &Preview " ;
ACTION (  TEST1(c_path), ;
   MsgInfo( MemoRead( "checkres.txt" ) ) ) 

oBtn4:lTransparent = .t.   
oBtn4:cTooltip :=  { "Preview" + CRLF + ;
  "the VTitle","Preview", 1, CLR_BLACK, 14089979 }

@ 120, 100 BTNBMP oBtn4 SIZE 60, 25 OF oDlg  2007 ;
FILENAME c_path + "\Images\save.bmp" ;
LEFT ;
PROMPT " &Check Res." ;
ACTION ( CheckRes2(c_path) )

*ACTION (  CheckRes(), ;
*   MsgInfo( MemoRead( "checkres.txt" ) ) ) 

oBtn4:lTransparent = .t.   
oBtn4:cTooltip :=  { "Save" + CRLF + ;
                                  "the working Project","Save Project", 1, CLR_BLACK, 14089979 }

@ 120, 170 BTNBMP oBtn5 SIZE 60, 25 OF oDlg  2007 ;
FILENAME c_path + "\Images\exit.bmp" ;
LEFT ;
PROMPT "  &Exit Test" ;
ACTION ( oDlg:End() )

oBtn5:lTransparent = .t.   
oBtn5:cTooltip :=  { "Close" + CRLF + ;
                                    "the Resource-Test","Close Window", 1, CLR_BLACK, 14089979 }

ACTIVATE DIALOG oDlg CENTERED

oFont2:End()

RETURN( NIL )

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

FUNCTION TEST1(c_path)
Local oDlg, oTitle3, oBtn4, oBtn5, oFont3

DEFINE FONT oFont3 NAME "Blackoak Std" size 30, 60      

DEFINE DIALOG oDlg FROM 20, 100 TO 350, 600 PIXEL ;
TITLE "VTitle-Test 2"

@ 15, 20 TITLE oTitle3 size 200, 80 of oDlg SHADOW TOPRIGHT 
    
oTitle3:aGrdBack = { { 1, nRGB( 129, 130, 138 ), nRGB( 59, 60, 62 ) } }
oTitle3:nShadowIntensity = 70
    
@  10, 10 TITLETEXT OF oTitle3 TEXT "A Title" FONT oFont3
@  15, 250  TITLEIMG OF oTitle3 BITMAP c_path + "\Images\save.bmp" TRANSPARENT   
@  15, 300 TITLEIMG OF oTitle3 BITMAP c_path + "\Images\exit.bmp" TRANSPARENT   

@ 120, 20 BTNBMP oBtn4 SIZE 80, 25 OF oDlg  2007 ;
FILENAME c_path + "\Images\save.bmp" ;
LEFT ;
PROMPT " &Check Resources " ;
ACTION ( CheckRes2(c_path) )

*ACTION (  CheckRes(), ;
*  MsgInfo( MemoRead( "checkres.txt" ) ) ) 

oBtn4:lTransparent = .t.   
oBtn4:cTooltip :=  { "Check" + CRLF + ;
  "Resources","Resources", 1, CLR_BLACK, 14089979 }

@ 120, 120 BTNBMP oBtn5 SIZE 80, 25 OF oDlg  2007 ;
FILENAME c_path + "\Images\exit.bmp" ;
LEFT ;
PROMPT "  &Exit Test" ;
ACTION ( oDlg:End() )

oBtn5:lTransparent = .t.   
oBtn5:cTooltip :=  { "Close" + CRLF + ;
  "the Resource-Test","Close Dialog", 1, CLR_BLACK, 14089979 }


ACTIVATE DIALOG oDlg 

oFont3:End()

RETURN( NIL )

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

FUNCTION CheckRes2(c_path)
LOCAL oDlg70, hDC, oBrw1, oBMP70, oBtn70, aResNew := {}, i

DEFINE DIALOG oDlg70 FROM 20, 100 TO 500, 600 PIXEL ;
TITLE "Resource-Test"

i := 1
FOR i := 1 to LEN( aResources )
   AAdd( aResNew, { i, aResources[i][1], aResources[i][2], aResources[i][3], aResources[i][4] } )
NEXT

MsgAlert( "Resource-Test     Entries " + LTRIM(STR(i-1)), "Entries" )

oBrw1 := TXBrowse():New( oDlg70 )

WITH OBJECT oBrw1

      :nTop         := 10
      :nLeft         := 10
      :nBottom   := 200
      :nRight       := 250

END

oBrw1:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw1:nColDividerStyle := LINESTYLE_BLACK
oBrw1:nRowDividerStyle := LINESTYLE_BLACK

oBrw1:bClrSelFocus = { || { 0, 16512957 } } 
oBrw1:bClrSel = { || { 0, 10853885 } } 
oBrw1:nRecSelColor = 15512898 

oBrw1:lHScroll := .T.
oBrw1:lVScroll := .T.
oBrw1:lFooter := .T.
oBrw1:nRowHeight := 25
oBrw1:nFooterHeight := 7

oBrw1:SetArray( aResNew )

oBrw1:aCols[ 1 ]:cHeader  := "Obj"
oBrw1:aCols[ 1 ]:nWidth  := 40

oBrw1:aCols[ 2 ]:cHeader  := "Type"
oBrw1:aCols[ 2 ]:nWidth  := 70

oBrw1:aCols[ 3 ]:cHeader  := "Resource"
oBrw1:aCols[ 3 ]:nWidth  := 90

oBrw1:aCols[ 4 ]:cHeader  := "Name"
oBrw1:aCols[ 4 ]:nWidth  := 160

oBrw1:aCols[ 5 ]:cHeader  := "Line"
oBrw1:aCols[ 5 ]:nWidth  := 50

aClrCol := { { 0, 16645846 }, { 0, 16512964 } }
oBrw1:bClrStd := { || aClrCol[ oBrw1:KeyNo % 2 + 1 ] } 

oBrw1:CreateFromCode() 

@ 210, 90 BTNBMP oBtn71 SIZE 80, 25 OF oDlg70  2007 ;
FILENAME c_path + "\Images\exit.bmp" ;
LEFT ;
PROMPT "  &Exit Test" ;
FONT oButtFont ;
ACTION ( oDlg70:End() )

oBtn71:lTransparent = .t.   
oBtn71:cTooltip :=  { "Close" + CRLF + ;
                                    "the Resource-Test","Close Dialog", 1, CLR_BLACK, 14089979 }

ACTIVATE DIALOG oDlg70 CENTERED 

RETURN( NIL )

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Sat Nov 14, 2009 02:03 PM
I used a external Tool < GDI-View > to collect GDI-Infos.
I get the same Results, like my included Function,
open and closing a VTitle-Preview-Dialog many Times.

The collected Screenshot-Lines shows : BMP's and Brushes are not released.
Is there a Solution in the meantime, to solve the GDI-problem ?

A Bitmap is called like :
@ 50, 50 TITLEIMG OF oBar BITMAP "Test.bmp" TRANSPARENT
and not defined, to do someting like : oBmp:End()
Maybe a possible Solution, a destroy of the complete VTitle ?



Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Sat Nov 14, 2009 07:01 PM
Uwe,

Bug located and fixed, many thanks :-)

In Class TTitle Method LoadBitmaps(), these lines are missing:
Code (fw): Select all Collapse
...
            hBmp = ResizeImg( aBmpPal[ 1 ], nWidth, nHeight ) 
            DeleteObject( aBmpPal[ 1 ] ) // new !!!
...
            hBmp = ResizeImg( aBmpPal[ 1 ], nWidth, nHeight )                    
            DeleteObject( aBmpPal[ 1 ] ) // new !!!

With those changes in Class TTitle, my previously posted small example, no longer looses GDI objects if we add these new lines to it:
Code (fw): Select all Collapse
#include "fivewin.ch"
#include "ttitle.ch"

Function main()

    local oWnd, oTitle1, oFont1
    
    SetResDebug()
    
    DEFINE FONT oFont1 NAME "Blackoak Std" size 30, 60      

    DEFINE WINDOW oWnd
    
    @ 015, 30 TITLE oTitle1 size 460, 60 of oWnd SHADOW TOPRIGHT 
    
    oTitle1:aGrdBack = { { 1, nRGB( 129, 130, 138 ), nRGB( 59, 60, 62 ) } }
    oTitle1:nShadowIntensity = 70
    
    @  10, 10 TITLETEXT OF oTitle1 TEXT "A Title" FONT oFont1
    
    @  15, 250 TITLEIMG OF oTitle1 BITMAP "c:\fwh\bitmaps\save.bmp" TRANSPARENT   // New !!! 
    @  15, 300 TITLEIMG OF oTitle1 BITMAP "c:\fwh\bitmaps\exit.bmp" TRANSPARENT    // New !!!

    ACTIVATE WINDOW oWnd
    
    oFont1:End()
    
    CheckRes()
    
    MsgInfo( MemoRead( "checkres.txt" ) )

return nil

Please test this example and also your larger example with those changes in the Class, thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Reduced Memory after VTitle-Dialog-Switch ?
Posted: Sat Nov 14, 2009 09:13 PM
Antonio,

thank You very much.
The BMP-Problem is solved and it works fine now inside the Tools.

The best GDI-Viewer I could find, to test any Application ( Freeware ) Size : 34 KB
Nothing to Install, just copy to a directory.
http://www.pflegeplus.com/fw_downloads/gdiview_1_03.zip


Your Resource-Test-Function is very helpful to detect this kind of Problem from inside a Function :

The Values a Start :


The Values after 5 Previews ( no Change ) :


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.