Reduced Memory after VTitle-Dialog-Switch ?

Reduced Memory after VTitle-Dialog-Switch ?

Postby ukoenig » Wed Nov 04, 2009 1: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
Image

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

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

Image

A Window with a Start-Button for the VTitle-Dialog :
Code: Select all  Expand view

#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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby James Bott » Wed Nov 04, 2009 2:00 am

Uwe,

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

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby Antonio Linares » Wed Nov 04, 2009 9:38 am

Uwe,

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

viewtopic.php?f=3&t=15935&start=0&hilit=setresdebug
regards, saludos

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

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby ukoenig » 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.

Image

Image

Best Regards
Uwe :lol:
[
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby Antonio Linares » Thu Nov 05, 2009 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby ukoenig » Thu Nov 05, 2009 3: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.

Image

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

Image

Image

The PRG-Structure, how I create the VTtitles :

Code: Select all  Expand view

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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby Antonio Linares » Thu Nov 05, 2009 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby Horizon » Thu Nov 05, 2009 8: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.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby ukoenig » 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 :
Image

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

3. Next I open the 1. Preview :
Image

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 )
Image

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.
Image

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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby Antonio Linares » 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: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby Horizon » Fri Nov 06, 2009 7:56 am

:?
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby ukoenig » 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.

Image

Resources-Check
Image

Code: Select all  Expand view

#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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby ukoenig » Sat Nov 14, 2009 2: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 ?

Image

Best Regards
Uwe :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby Antonio Linares » Sat Nov 14, 2009 7:01 pm

Uwe,

Bug located and fixed, many thanks :-)

In Class TTitle Method LoadBitmaps(), these lines are missing:
Code: Select all  Expand view

...
            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: Select all  Expand view

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

Re: Reduced Memory after VTitle-Dialog-Switch ?

Postby ukoenig » Sat Nov 14, 2009 9: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
Image

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

The Values a Start :
Image

The Values after 5 Previews ( no Change ) :
Image

Best Regards
Uwe :lol:
Last edited by ukoenig on Sun Nov 15, 2009 1:28 am, edited 1 time in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 83 guests