Fuga de recursos

User avatar
rolando
Posts: 593
Joined: Sat May 12, 2007 11:47 am
Location: San Nicolás - BA - ARGENTINA

Re: Fuga de recursos

Post by rolando »

Antonio,

Interesante. Sobre todo porque permite una opción de "Mostrar sólo cambios" y sirve para ver que objetos que quedaron sin cerrar luego de por ej. abrir un dialog y cerrarlo.

Saludos.

Rolando :D
Cgallegoa
Posts: 497
Joined: Sun Oct 16, 2005 3:32 am
Location: Quito - Ecuador
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Fuga de recursos

Post by Cgallegoa »

La function GetGdiObjects() de Patrizio :-)

http://forums.fivetechsupport.com/viewtopic.php?f=3&t=9732&start=0&hilit=GDI+objects+leaks

Patrizio wrote:
Antonio Linares wrote:Patrizio,

>
TVSetColor increment by two the GDI objects (two brushes) in use without decrement when destroy the TreeView.
>

How do you know this ? How have you checked it ? Thanks


I use MSDN GDIndicator e GDIUsage : http://msdn.microsoft.com/msdnmag/issue ... /GDILeaks/

In this case GDIndicator show you the type of gdi objects used by an application.

I've check it with this sample:

Code: Select all | Expand

PROC Main()
   LOCAL oDlg, n
   FOR n := 1 TO 5
      InitDialogGDI()
      SysRefresh()
      HB_GCall()
      MsgInfo("GDI objects:" + AllTrim(Str(GetGDIObjects(),7)))
   NEXT
RETURN

PROC InitDialogGDI()
   LOCAL oDlg, oTree
   oDlg  := TDialog():New(,,,,,"DLG_GDI")
   oTree := TTreeView():ReDefine(1190,oDlg,CLR_BLUE,CLR_YELLOW,.T.,"l0")
   oDlg:Activate(,,,.F.,{||.T.},.T.,,,,)
   oDlg:End()
RETURN

#pragma BEGINDUMP

#include <hbapi.h>
#include <Windows.h>
#include <WinUser.h>
#include <ClipApi.h>

HB_FUNC( GETGDIOBJECTS )
{
   hb_retnd( GetGuiResources( GetCurrentProcess(), 0 ) );
}

#pragma ENDDUMP


Code: Select all | Expand

DLG_GDI DIALOG DISCARDABLE 0, 0, 616, 428
STYLE DS_CENTER|WS_THICKFRAME|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_VISIBLE
CAPTION "GDI"
FONT 8, "MS Sans Serif"
BEGIN
  CONTROL "", 1190, "SysTreeView32", TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT|TVS_EDITLABELS|TVS_SHOWSELALWAYS|TVS_NOTOOLTIPS|TVS_FULLROWSELECT|WS_BORDER|WS_TABSTOP, 8, 36, 220, 312
END
Saludos,

Carlos Gallego

*** FWH-24.07, xHarbour 1.3.1 Build 20240624, Borland C++7.70, PellesC ***
Post Reply