Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #9310 > unrolled thread

GDI Objects creeping up

Started byMartin <Martin@spam.spam>
First post2016-05-03 14:30 +0100
Last post2016-05-07 13:12 -0400
Articles 15 — 7 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  GDI Objects creeping up Martin <Martin@spam.spam> - 2016-05-03 14:30 +0100
    Re: GDI Objects creeping up "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> - 2016-05-04 08:58 +0200
      Re: GDI Objects creeping up Martin <Martin@spam.spam> - 2016-05-04 09:07 +0100
      Re: GDI Objects creeping up Martin <Martin@spam.spam> - 2016-05-04 11:05 +0100
    Re: GDI Objects creeping up Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2016-05-04 11:21 +0200
      Re: GDI Objects creeping up Martin <Martin@spam.spam> - 2016-05-04 11:10 +0100
        Re: GDI Objects creeping up Benito Fernández Meneses <bfernandez@bfmconsultores.com.mx> - 2016-05-04 10:29 -0500
          Re: GDI Objects creeping up "Jamal Assaf" <someone@example.com> - 2016-05-04 21:34 -0400
            Re: GDI Objects creeping up Camille Kater <katercam@pt.lu> - 2016-05-05 09:52 +0200
            Re: GDI Objects creeping up Otto Christiaanse <ofchristiaanse@gmail.com> - 2016-05-05 03:47 -0700
              Re: GDI Objects creeping up "Jamal Assaf" <someone@example.com> - 2016-05-07 13:09 -0400
                Re: GDI Objects creeping up "Jamal Assaf" <someone@example.com> - 2016-05-08 00:50 -0400
                  Re: GDI Objects creeping up Otto Christiaanse <ofchristiaanse@gmail.com> - 2016-05-17 02:33 -0700
          Re: GDI Objects creeping up Martin <Martin@spam.spam> - 2016-05-05 09:37 +0100
    Re: GDI Objects creeping up "Jamal Assaf" <someone@example.com> - 2016-05-07 13:12 -0400

#9310 — GDI Objects creeping up

FromMartin <Martin@spam.spam>
Date2016-05-03 14:30 +0100
SubjectGDI Objects creeping up
Message-ID<nga8uu$n54$2@dont-email.me>
Hello

I use the following to monitor GDI Objects

GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS)

And now we are finding that is it creeping up a lot.

Any ideas what to check, I know there must be a leak, but where do I look?

Thanks

Martin

[toc] | [next] | [standalone]


#9314

From"Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it>
Date2016-05-04 08:58 +0200
Message-ID<ngc6c9$u97$1@dont-email.me>
In reply to#9310
Hello Martin,

it can be also the missing call of the garbage collector. I have inserted in 
our programs the check for too many open GDI objects regularly and if it 
superizes a certain limit a collectforced() is called.

Many years ago we had real problems with GDI objects not destroyed 
correctly. We made a new Icon class inherited from ICON and we needed to 
insert a "DestroyIcon" and RegisterAxit explicitly. But I do not remember 
how we found out.

Arne Ortlinghaus
ACS Data Systems

"Martin" <Martin@spam.spam> schrieb im Newsbeitrag 
news:nga8uu$n54$2@dont-email.me...
> Hello
>
> I use the following to monitor GDI Objects
>
> GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS)
>
> And now we are finding that is it creeping up a lot.
>
> Any ideas what to check, I know there must be a leak, but where do I look?
>
> Thanks
>
> Martin 

[toc] | [prev] | [next] | [standalone]


#9316

FromMartin <Martin@spam.spam>
Date2016-05-04 09:07 +0100
Message-ID<ngcadb$69m$1@dont-email.me>
In reply to#9314
Thankyou

I already have a GC sitting in many of these screens, but it still does 
not lower the GDI by much.

I do remember having to put all pointers into variables as they leaked 
like nobodies business.

Could I see your samples please?

Thanks

Martin

On 04/05/2016 07:58, Arne Ortlinghaus wrote:
> Hello Martin,
>
> it can be also the missing call of the garbage collector. I have
> inserted in our programs the check for too many open GDI objects
> regularly and if it superizes a certain limit a collectforced() is called.
>
> Many years ago we had real problems with GDI objects not destroyed
> correctly. We made a new Icon class inherited from ICON and we needed to
> insert a "DestroyIcon" and RegisterAxit explicitly. But I do not
> remember how we found out.
>
> Arne Ortlinghaus
> ACS Data Systems
>
> "Martin" <Martin@spam.spam> schrieb im Newsbeitrag
> news:nga8uu$n54$2@dont-email.me...
>> Hello
>>
>> I use the following to monitor GDI Objects
>>
>> GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS)
>>
>> And now we are finding that is it creeping up a lot.
>>
>> Any ideas what to check, I know there must be a leak, but where do I
>> look?
>>
>> Thanks
>>
>> Martin
>

[toc] | [prev] | [next] | [standalone]


#9318

FromMartin <Martin@spam.spam>
Date2016-05-04 11:05 +0100
Message-ID<ngcha5$dos$1@dont-email.me>
In reply to#9314
We are mainly using the class bIcon from bbrowser

I am now looking for diffrences between leaking and non leaking code

On 04/05/2016 07:58, Arne Ortlinghaus wrote:
> Hello Martin,
>
> it can be also the missing call of the garbage collector. I have
> inserted in our programs the check for too many open GDI objects
> regularly and if it superizes a certain limit a collectforced() is called.
>
> Many years ago we had real problems with GDI objects not destroyed
> correctly. We made a new Icon class inherited from ICON and we needed to
> insert a "DestroyIcon" and RegisterAxit explicitly. But I do not
> remember how we found out.
>
> Arne Ortlinghaus
> ACS Data Systems
>
> "Martin" <Martin@spam.spam> schrieb im Newsbeitrag
> news:nga8uu$n54$2@dont-email.me...
>> Hello
>>
>> I use the following to monitor GDI Objects
>>
>> GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS)
>>
>> And now we are finding that is it creeping up a lot.
>>
>> Any ideas what to check, I know there must be a leak, but where do I
>> look?
>>
>> Thanks
>>
>> Martin
>

[toc] | [prev] | [next] | [standalone]


#9317

FromKarl Faller <mail_withoutthat_@_drei-f_andthat_.de>
Date2016-05-04 11:21 +0200
Message-ID<nqejibh2atflb7j8klqdmgc5sdfecsjh6j@4ax.com>
In reply to#9310
Martin,
just some ideas;
look at
https://support.microsoft.com/de-de/kb/2719248
possibly related?

Then i read in the help:
...
Notes
Deselecting a Font:        In Windows, the current font should be
deselected before destroying the window.  To do this, use Window:Font
to assign the previous font, for example.  However, this is only
necessary if there is a font other than the default one currently
selected.
...
It won't say, "why" you have to deselect - maybe because the font
won't get released automatically?

And you are sure, you destroy explicitely things like brushes etc.?

KArl

>Hello
>
>I use the following to monitor GDI Objects
>
>GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS)
>
>And now we are finding that is it creeping up a lot.
>
>Any ideas what to check, I know there must be a leak, but where do I look?
>
>Thanks
>
>Martin
Regards

Karl

[toc] | [prev] | [next] | [standalone]


#9319

FromMartin <Martin@spam.spam>
Date2016-05-04 11:10 +0100
Message-ID<ngchkd$h49$1@dont-email.me>
In reply to#9317
Some good food for thought there Karl

Well on one screen I have code like below

This is in a bbrowser cell

oFont	:= Font{,8,"MS Shell Dlg"}

bcVal:AddValue(bCompoundValue{cDriver,;
    Point{ 0,48},;
    Dimension{67,16},,,,oFont})

bcVal:AddValue(bCompoundValue{cLorry,;
    Point{68,48},;
    Dimension{61,16},BALIGN_RIGHT,,,oFont})

Not sure if this is good or not.

Thanks

Martin

On 04/05/2016 10:21, Karl Faller wrote:
> Martin,
> just some ideas;
> look at
> https://support.microsoft.com/de-de/kb/2719248
> possibly related?
>
> Then i read in the help:
> ...
> Notes
> Deselecting a Font:        In Windows, the current font should be
> deselected before destroying the window.  To do this, use Window:Font
> to assign the previous font, for example.  However, this is only
> necessary if there is a font other than the default one currently
> selected.
> ...
> It won't say, "why" you have to deselect - maybe because the font
> won't get released automatically?
>
> And you are sure, you destroy explicitely things like brushes etc.?
>
> KArl
>
>> Hello
>>
>> I use the following to monitor GDI Objects
>>
>> GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS)
>>
>> And now we are finding that is it creeping up a lot.
>>
>> Any ideas what to check, I know there must be a leak, but where do I look?
>>
>> Thanks
>>
>> Martin
> Regards
>
> Karl
>

[toc] | [prev] | [next] | [standalone]


#9325

FromBenito Fernández Meneses <bfernandez@bfmconsultores.com.mx>
Date2016-05-04 10:29 -0500
Message-ID<d25kib951f5n3vmffkpsivovkgl5km3p55@4ax.com>
In reply to#9319
Martin,

In my methods I always use local variables declared as DIM, at some
post I read that using a Font, Brush, Color, etc. use a declare
statement  as

LOCAL DIM aFonts[3] AS Font

It get released as the method goes out of scope.

HTH
Benito


On Wed, 4 May 2016 11:10:52 +0100, Martin <Martin@spam.spam> wrote:

>Some good food for thought there Karl
>
>Well on one screen I have code like below
>
>This is in a bbrowser cell
>
>oFont	:= Font{,8,"MS Shell Dlg"}
>
>bcVal:AddValue(bCompoundValue{cDriver,;
>    Point{ 0,48},;
>    Dimension{67,16},,,,oFont})
>
>bcVal:AddValue(bCompoundValue{cLorry,;
>    Point{68,48},;
>    Dimension{61,16},BALIGN_RIGHT,,,oFont})
>
>Not sure if this is good or not.
>
>Thanks
>
>Martin
>
>On 04/05/2016 10:21, Karl Faller wrote:
>> Martin,
>> just some ideas;
>> look at
>> https://support.microsoft.com/de-de/kb/2719248
>> possibly related?
>>
>> Then i read in the help:
>> ...
>> Notes
>> Deselecting a Font:        In Windows, the current font should be
>> deselected before destroying the window.  To do this, use Window:Font
>> to assign the previous font, for example.  However, this is only
>> necessary if there is a font other than the default one currently
>> selected.
>> ...
>> It won't say, "why" you have to deselect - maybe because the font
>> won't get released automatically?
>>
>> And you are sure, you destroy explicitely things like brushes etc.?
>>
>> KArl
>>
>>> Hello
>>>
>>> I use the following to monitor GDI Objects
>>>
>>> GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS)
>>>
>>> And now we are finding that is it creeping up a lot.
>>>
>>> Any ideas what to check, I know there must be a leak, but where do I look?
>>>
>>> Thanks
>>>
>>> Martin
>> Regards
>>
>> Karl
>>

[toc] | [prev] | [next] | [standalone]


#9326

From"Jamal Assaf" <someone@example.com>
Date2016-05-04 21:34 -0400
Message-ID<nge7vm$bld$1@news.albasani.net>
In reply to#9325
Hi Benito,

I have not read any posts that DIM itself make objects go out of scope upon 
returning from a method. May be you could point out where you read this 
info.

Here is my understanding:

LOCAL variables regardless of their type will be collected by the GC 
(Garbage Collector) at a certain point.

What would be better is to help the GC by setting oFont := NULL_OBJECT 
before returning from the method or function. He's using one object: oFont.

Inserting CollectForced() in strategic places could also be used to force 
the GC to clean up especially when large arrays are used or brush, font, 
color objects are used.

Jamal

"Benito Fernández Meneses"  wrote in message 
news:d25kib951f5n3vmffkpsivovkgl5km3p55@4ax.com...

Martin,

In my methods I always use local variables declared as DIM, at some
post I read that using a Font, Brush, Color, etc. use a declare
statement  as

LOCAL DIM aFonts[3] AS Font

It get released as the method goes out of scope.

HTH
Benito


On Wed, 4 May 2016 11:10:52 +0100, Martin <Martin@spam.spam> wrote:

>Some good food for thought there Karl
>
>Well on one screen I have code like below
>
>This is in a bbrowser cell
>
>oFont := Font{,8,"MS Shell Dlg"}
>
>bcVal:AddValue(bCompoundValue{cDriver,;
>    Point{ 0,48},;
>    Dimension{67,16},,,,oFont})
>
>bcVal:AddValue(bCompoundValue{cLorry,;
>    Point{68,48},;
>    Dimension{61,16},BALIGN_RIGHT,,,oFont})
>
>Not sure if this is good or not.
>
>Thanks
>
>Martin
>
>On 04/05/2016 10:21, Karl Faller wrote:
>> Martin,
>> just some ideas;
>> look at
>> https://support.microsoft.com/de-de/kb/2719248
>> possibly related?
>>
>> Then i read in the help:
>> ...
>> Notes
>> Deselecting a Font:        In Windows, the current font should be
>> deselected before destroying the window.  To do this, use Window:Font
>> to assign the previous font, for example.  However, this is only
>> necessary if there is a font other than the default one currently
>> selected.
>> ...
>> It won't say, "why" you have to deselect - maybe because the font
>> won't get released automatically?
>>
>> And you are sure, you destroy explicitely things like brushes etc.?
>>
>> KArl
>>
>>> Hello
>>>
>>> I use the following to monitor GDI Objects
>>>
>>> GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS)
>>>
>>> And now we are finding that is it creeping up a lot.
>>>
>>> Any ideas what to check, I know there must be a leak, but where do I 
>>> look?
>>>
>>> Thanks
>>>
>>> Martin
>> Regards
>>
>> Karl
>> 

[toc] | [prev] | [next] | [standalone]


#9327

FromCamille Kater <katercam@pt.lu>
Date2016-05-05 09:52 +0200
Message-ID<1462429025_1@vo.lu>
In reply to#9326
Hi Jamal,

In the auto-generated init() method of the painted class you will often 
find the following code:

example:
Method init(oWindow,iCtlID,oServer,uExtra) CLASS MyWindow
LOCAL DIM aFonts[3] AS OBJECT
LOCAL DIM aBrushes[1] AS OBJECT

SELF:PreInit(oWindow,iCtlID,oServer,uExtra)

SUPER:Init(oWindow,ResourceID{"MyWindow",_GetInst()},iCtlID)

aFonts[1] := Font{,8,"MS Sans Serif"}
aFonts[1]:Bold := TRUE
aFonts[2] := Font{,8,"Microsoft Sans Serif"}
aFonts[2]:Bold := TRUE
aFonts[3] := Font{,10,"Microsoft Sans Serif"}
aFonts[3]:Bold := TRUE
aBrushes[1] := Brush{Color{157,191,255}}
....

My understanding is: As you deal here with arrays, they go out of scope
upon closing this class.

Camille


On 05/05/16 03:34, Jamal Assaf wrote:
> Hi Benito,
>
> I have not read any posts that DIM itself make objects go out of scope
> upon returning from a method. May be you could point out where you read
> this info.

[toc] | [prev] | [next] | [standalone]


#9329

FromOtto Christiaanse <ofchristiaanse@gmail.com>
Date2016-05-05 03:47 -0700
Message-ID<bb6b673b-7a00-4779-84c5-e752310f3dd4@googlegroups.com>
In reply to#9326
On Thursday, May 5, 2016 at 3:34:48 AM UTC+2, Jamal Assaf wrote:

> What would be better is to help the GC by setting oFont := NULL_OBJECT 
> before returning from the method or function. He's using one object: oFont.

There was a bug in VO 2.x (<=2.5?) regarding this, which has been fixed in vo 2.7(?). So, in 2.8 this shouldn't be necessary. I wouldn't know in what way gui classes are different then other classes/objects that this explicit de referencing should still be necessary.

Regards,

Otto

[toc] | [prev] | [next] | [standalone]


#9340

From"Jamal Assaf" <someone@example.com>
Date2016-05-07 13:09 -0400
Message-ID<ngl7g5$4ma$1@news.albasani.net>
In reply to#9329
Otto,

The key word in my previous post  is "help" which means it's not necessary, 
but it does hurt to do it and it may be a good thing for the GC to dispose 
null objects.

Jamal

"Otto Christiaanse"  wrote in message 
news:bb6b673b-7a00-4779-84c5-e752310f3dd4@googlegroups.com...

On Thursday, May 5, 2016 at 3:34:48 AM UTC+2, Jamal Assaf wrote:

> What would be better is to help the GC by setting oFont := NULL_OBJECT
> before returning from the method or function. He's using one object: 
> oFont.

There was a bug in VO 2.x (<=2.5?) regarding this, which has been fixed in 
vo 2.7(?). So, in 2.8 this shouldn't be necessary. I wouldn't know in what 
way gui classes are different then other classes/objects that this explicit 
de referencing should still be necessary.

Regards,

Otto 

[toc] | [prev] | [next] | [standalone]


#9342

From"Jamal Assaf" <someone@example.com>
Date2016-05-08 00:50 -0400
Message-ID<ngmgit$vjt$1@news.albasani.net>
In reply to#9340
oops! I meant to say "NOT"!

The key word in my previous post  is "help" which means it's not necessary,
but it does NOT hurt to do it and it may be a good thing for the GC to 
dispose
null objects.

"Jamal Assaf"  wrote in message news:ngl7g5$4ma$1@news.albasani.net...

Otto,

The key word in my previous post  is "help" which means it's not necessary,
but it does hurt to do it and it may be a good thing for the GC to dispose
null objects.

Jamal

"Otto Christiaanse"  wrote in message
news:bb6b673b-7a00-4779-84c5-e752310f3dd4@googlegroups.com...

On Thursday, May 5, 2016 at 3:34:48 AM UTC+2, Jamal Assaf wrote:

> What would be better is to help the GC by setting oFont := NULL_OBJECT
> before returning from the method or function. He's using one object: 
> oFont.

There was a bug in VO 2.x (<=2.5?) regarding this, which has been fixed in
vo 2.7(?). So, in 2.8 this shouldn't be necessary. I wouldn't know in what
way gui classes are different then other classes/objects that this explicit
de referencing should still be necessary.

Regards,

Otto 

[toc] | [prev] | [next] | [standalone]


#9367

FromOtto Christiaanse <ofchristiaanse@gmail.com>
Date2016-05-17 02:33 -0700
Message-ID<c91d5f86-8524-488f-ae67-a6948d6ec4a5@googlegroups.com>
In reply to#9342
On Sunday, May 8, 2016 at 6:50:38 AM UTC+2, Jamal Assaf wrote:
> The key word in my previous post  is "help" which means it's not necessary,
> but it does NOT hurt to do it and it may be a good thing for the GC to 
> dispose
> null objects.

The local is dereferenced at the end if the lifetime of the method/function.
I know a company that has a code quality check demanding this kind of dereference lines. They are necessary to get the code into production.
Not my style, because it is/was code to work around an already fixed compiler bug. These kind of workarounds may introduce new problems.

The GCDump way is the better solution.

Other hints: if you create objects in loops, they won't be cleaned up at the correct time. Dereferencing won't help here. Splitting the logic over more methods/functions etc might give the GarbageCollector enough hints to automatically kick in.
If that won't work: an intelligent call to CollectForced() could save some pain.

[toc] | [prev] | [next] | [standalone]


#9328

FromMartin <Martin@spam.spam>
Date2016-05-05 09:37 +0100
Message-ID<ngf0gr$l44$1@dont-email.me>
In reply to#9325
I modded the code to do the font once and subclassed it into a debug version

All created
All destroyed

Need to look at other things now

I have a few classes for cells on bbrowsers, are there any potentials 
leaks in this draw code?

This is a class added to a bcompoundvalue, real name is not xxxxx

CLASS xxxxx
	// bar chart
	PROTECT nCol			AS DWORD

	// methods
	DECLARE METHOD 	Draw
METHOD Init(nCol) CLASS xxxxx
	// initialize
	SELF:nCol := nCol
	RETURN SELF
METHOD Draw(hDC AS PTR, srcArea AS _winRect) AS LOGIC PASCAL CLASS xxxxx
LOCAL iBarWidth		AS INT, ;
       iBarHeight	AS INT, ;
       oBrush		AS Brush, ;
       iLeft			AS INT, ;
       iRight		AS INT, ;
       iTop			AS INT, ;
       iBot			AS INT

// determine max. height
iBarHeight	:= srcArea.Bottom-srcArea.Top-2

// determine width of a bar
iBarWidth	:= srcArea.Right-srcArea.Left-2

iLeft		:= srcArea.Left-1
iRight		:= iLeft+iBarWidth
iTop		:= srcArea.Bottom-1-iBarHeight
iBot		:= srcArea.Bottom-1

SelectObject(hDC, GetStockObject(NULL_PEN))
DO CASE
	CASE Empty(SELF:nCol) .OR. SELF:nCol = 0
		oBrush := Brush{Color{COLORBLUE}}

	CASE SELF:nCol = 1
		oBrush := Brush{Color{COLORGREEN}}

	CASE SELF:nCol = 2
		oBrush := Brush{Color{COLORRED}}

	CASE SELF:nCol = 3
		oBrush := Brush{Color{COLORYELLOW}}

ENDCASE

//		draw bar
SelectObject(hDC, oBrush:Handle())
Rectangle(hDC, iLeft, iTop, iRight, iBot)

RestoreDC(hDC, -1)

RETURN TRUE










On 04/05/2016 16:29, Benito Fern�ndez Meneses wrote:
> Martin,
>
> In my methods I always use local variables declared as DIM, at some
> post I read that using a Font, Brush, Color, etc. use a declare
> statement  as
>
> LOCAL DIM aFonts[3] AS Font
>
> It get released as the method goes out of scope.
>
> HTH
> Benito
>
>
> On Wed, 4 May 2016 11:10:52 +0100, Martin <Martin@spam.spam> wrote:
>
>> Some good food for thought there Karl
>>
>> Well on one screen I have code like below
>>
>> This is in a bbrowser cell
>>
>> oFont	:= Font{,8,"MS Shell Dlg"}
>>
>> bcVal:AddValue(bCompoundValue{cDriver,;
>>     Point{ 0,48},;
>>     Dimension{67,16},,,,oFont})
>>
>> bcVal:AddValue(bCompoundValue{cLorry,;
>>     Point{68,48},;
>>     Dimension{61,16},BALIGN_RIGHT,,,oFont})
>>
>> Not sure if this is good or not.
>>
>> Thanks
>>
>> Martin
>>
>> On 04/05/2016 10:21, Karl Faller wrote:
>>> Martin,
>>> just some ideas;
>>> look at
>>> https://support.microsoft.com/de-de/kb/2719248
>>> possibly related?
>>>
>>> Then i read in the help:
>>> ...
>>> Notes
>>> Deselecting a Font:        In Windows, the current font should be
>>> deselected before destroying the window.  To do this, use Window:Font
>>> to assign the previous font, for example.  However, this is only
>>> necessary if there is a font other than the default one currently
>>> selected.
>>> ...
>>> It won't say, "why" you have to deselect - maybe because the font
>>> won't get released automatically?
>>>
>>> And you are sure, you destroy explicitely things like brushes etc.?
>>>
>>> KArl
>>>
>>>> Hello
>>>>
>>>> I use the following to monitor GDI Objects
>>>>
>>>> GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS)
>>>>
>>>> And now we are finding that is it creeping up a lot.
>>>>
>>>> Any ideas what to check, I know there must be a leak, but where do I look?
>>>>
>>>> Thanks
>>>>
>>>> Martin
>>> Regards
>>>
>>> Karl
>>>

[toc] | [prev] | [next] | [standalone]


#9341

From"Jamal Assaf" <someone@example.com>
Date2016-05-07 13:12 -0400
Message-ID<ngl7ko$52a$1@news.albasani.net>
In reply to#9310
From long time ago, some brilliant soul on this NG wrote these functions; it 
may help find the issue you are encountering:

FUNCTION GCDump(nType)
LOCAL pDump AS _GCDUMP
LOCAL pEntry AS  _GCENTRY
LOCAL nAlloc AS INT
LOCAL nEntries, dwCount AS DWORD
LOCAL aTypeStr AS ARRAY

     // If you don't pass a value, default to all references
     Default(@nType, 0 )
     aTypeStr :=  {"*","**","FLOAT","****","ARRAY","OBJECT","STRING"}  // GC 
entry types

     IF !InCollect()
         CollectForced()

     ENDIF
     DynLock() // lock up dynamic mem to obtain accurate result

     nAlloc := _SIZEOF(DWORD) + 100 * _SIZEOF(_GCENTRY)
     pDump := MemAlloc(nAlloc)

     IF pDump != NULL_PTR
          pDump.nEntryCount := 100
          nEntries := CreateGCDump(pDump, nType)
          LogIt("Total Entries: " + NTrim(nEntries), 
MyGetCurPath()+"GCDump.log")
          FOR dwCount := 1 UPTO nEntries
               pEntry := @pDump.GCE[dwCount]
               LogIt("====== Entry: " + NTrim(dwCount) + " =======:", 
MyGetCurPath()+"GCDump.log")
               LogIt("Created by : " + IIF(pEntry.nGCType == GC_TYPE_STACK, 
"Compiler", "RegisterKid()"),MyGetCurPath()+"GCDump.log")
               LogIt("Var. Type  : " + 
aTypeStr[pEntry.nVarType],MyGetCurPath()+"GCDump.log")
               LogIt("Dyn. Addr. : " + 
AsString(pEntry.pDynMem),MyGetCurPath()+"GCDump.log")
               LogIt("Size (bytes): " + 
NTrim(pEntry.nSize),MyGetCurPath()+"GCDump.log")
               LogIt("Ref. Addr. : " + 
AsString(pEntry.ppRefDynMem),MyGetCurPath()+"GCDump.log")
               LogIt("Value      : " + 
Psz2String(@pEntry.abValue[1]),MyGetCurPath()+"GCDump.log")
          NEXT
     ENDIF
     DynUnLock()
RETURN
FUNCTION LogIt(cMsg AS STRING,cFile AS STRING) AS VOID PASCAL
LOCAL ptrFile AS PTR

IF LOG_FILE_ON
  IF File(cFile)
       ptrFile := FOpen2(cFile,FO_READWRITE)
       // Move to bottom of file
       FSeek(ptrFile, 0, FS_END)
  ELSE
       ptrFile := FCreate2(cFile,FC_NORMAL)
  ENDIF
  FWriteLine(ptrFile,DToC(Today())+"-"+Time()+":"+cMsg)
  FClose(ptrFile)
ENDIF
RETURN
DEFINE LOG_FILE_ON := TRUE

FUNCTION GCDumpNone()

     IF !InCollect()
         CollectForced()

     ENDIF
RETURN



Jamal

"Martin"  wrote in message news:nga8uu$n54$2@dont-email.me...

Hello

I use the following to monitor GDI Objects

GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS)

And now we are finding that is it creeping up a lot.

Any ideas what to check, I know there must be a leak, but where do I look?

Thanks

Martin 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web