Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #11081 > unrolled thread
| Started by | Martin <Martin@spam.spam> |
|---|---|
| First post | 2017-10-24 14:27 +0100 |
| Last post | 2017-10-31 11:57 +0000 |
| Articles | 12 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
GDI usage going up on ApplciationExecs Martin <Martin@spam.spam> - 2017-10-24 14:27 +0100
Re: GDI usage going up on ApplciationExecs Martin <Martin@spam.spam> - 2017-10-24 16:56 +0100
Re: GDI usage going up on ApplciationExecs Martin <Martin@spam.spam> - 2017-10-24 17:00 +0100
Re: GDI usage going up on ApplciationExecs Robert van der Hulst <rjvanderhulst@gmail.com> - 2017-10-24 23:58 -0700
Re: GDI usage going up on ApplciationExecs Martin <Martin@spam.spam> - 2017-10-31 12:00 +0000
Re: GDI usage going up on ApplciationExecs "Karl-Heinz" <invalid@invalid.invalid> - 2017-10-25 12:21 +0200
Re: GDI usage going up on ApplciationExecs Martin <Martin@spam.spam> - 2017-10-31 11:58 +0000
Re: GDI usage going up on ApplciationExecs Martin <Martin@spam.spam> - 2017-10-25 09:19 +0100
Re: GDI usage going up on ApplciationExecs Martin <Martin@spam.spam> - 2017-10-25 10:54 +0100
Re: GDI usage going up on ApplciationExecs Martin <Martin@spam.spam> - 2017-10-25 12:00 +0100
Re: GDI usage going up on ApplciationExecs Arne Ortlinghaus <Arne.Ortlinghaus@acs.it> - 2017-10-27 17:05 +0200
Re: GDI usage going up on ApplciationExecs Martin <Martin@spam.spam> - 2017-10-31 11:57 +0000
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2017-10-24 14:27 +0100 |
| Subject | GDI usage going up on ApplciationExecs |
| Message-ID | <osnf4k$q60$1@dont-email.me> |
Hello All I am going through a program which is left running over night and occasionally runs out of GDI resources. I have fixed one 3 object leak as I forgot a ReleaseDC in two very similar classes. During a load or a refresh I do call ApplicationExec to keep the screen from freezing, but at one call I lose 1 GDI object and another 9 GDI objects. I will experiment with removal, but any ideas why it would go up? Thanks Martin
[toc] | [next] | [standalone]
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2017-10-24 16:56 +0100 |
| Message-ID | <osnnrb$154$1@dont-email.me> |
| In reply to | #11081 |
Found it in some code we inherited to do with column titles 1 object lost in redrawing a column title. SELF:Redraw(#CAPTION) 10 in refreshing the browser. SELF:Refresh() Will now drop debugs into the bbrowser code to find the leaks On 24/10/2017 14:27, Martin wrote: > Hello All > > I am going through a program which is left running over night and > occasionally runs out of GDI resources. > > I have fixed one 3 object leak as I forgot a ReleaseDC in two very > similar classes. > > During a load or a refresh I do call ApplicationExec to keep the screen > from freezing, but at one call I lose 1 GDI object and another 9 GDI > objects. > > I will experiment with removal, but any ideas why it would go up? > > Thanks > > Martin
[toc] | [prev] | [next] | [standalone]
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2017-10-24 17:00 +0100 |
| Message-ID | <osno3a$2qn$1@dont-email.me> |
| In reply to | #11082 |
this line below takes up one GDI object within bbrowser InvalidateRect(self:Handle(), ptr(_cast, @self:srcCaptionArea), False) On 24/10/2017 16:56, Martin wrote: > Found it in some code we inherited to do with column titles > > 1 object lost in redrawing a column title. > SELF:Redraw(#CAPTION) > > > 10 in refreshing the browser. > SELF:Refresh() > > > Will now drop debugs into the bbrowser code to find the leaks > > > On 24/10/2017 14:27, Martin wrote: >> Hello All >> >> I am going through a program which is left running over night and >> occasionally runs out of GDI resources. >> >> I have fixed one 3 object leak as I forgot a ReleaseDC in two very >> similar classes. >> >> During a load or a refresh I do call ApplicationExec to keep the >> screen from freezing, but at one call I lose 1 GDI object and another >> 9 GDI objects. >> >> I will experiment with removal, but any ideas why it would go up? >> >> Thanks >> >> Martin >
[toc] | [prev] | [next] | [standalone]
| From | Robert van der Hulst <rjvanderhulst@gmail.com> |
|---|---|
| Date | 2017-10-24 23:58 -0700 |
| Message-ID | <03d161dd-55a5-499c-af4a-18f82354ff2f@googlegroups.com> |
| In reply to | #11083 |
Martin, I seriously doubt that the InvalidateRect is responsible for a GDI loss. It is most likely caused by code that runs as a result of this API call The MSDN docs say about the handle: A handle to the window whose update region has changed. If this parameter is NULL, the system invalidates and redraws all windows, not just the windows for this application, and sends the WM_ERASEBKGND and WM_NCPAINT messages before the function returns. Setting this parameter to NULL is not recommended. So I would look for WM_ERASEBKGND, WM_NCPAINT Robert > this line below takes up one GDI object within bbrowser > > InvalidateRect(self:Handle(), ptr(_cast, @self:srcCaptionArea), False) > > > On 24/10/2017 16:56, Martin wrote: > > Found it in some code we inherited to do with column titles > > > > 1 object lost in redrawing a column title. > > SELF:Redraw(#CAPTION) > > > > > > 10 in refreshing the browser. > > SELF:Refresh() > > > > > > Will now drop debugs into the bbrowser code to find the leaks > > > > > > On 24/10/2017 14:27, Martin wrote: > >> Hello All > >> > >> I am going through a program which is left running over night and > >> occasionally runs out of GDI resources. > >> > >> I have fixed one 3 object leak as I forgot a ReleaseDC in two very > >> similar classes. > >> > >> During a load or a refresh I do call ApplicationExec to keep the > >> screen from freezing, but at one call I lose 1 GDI object and another > >> 9 GDI objects. > >> > >> I will experiment with removal, but any ideas why it would go up? > >> > >> Thanks > >> > >> Martin > >
[toc] | [prev] | [next] | [standalone]
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2017-10-31 12:00 +0000 |
| Message-ID | <ot9ol3$ji2$3@dont-email.me> |
| In reply to | #11084 |
It was the trigger not the cause, I had found the leak, but eventually memory usage stablised and did not get worse. In office I would test for an hour, but customers leave it up for a day or more. Anyway still learning programming even after 30 years On 25/10/2017 07:58, Robert van der Hulst wrote: > Martin, > > I seriously doubt that the InvalidateRect is responsible for a GDI loss. > It is most likely caused by code that runs as a result of this API call > The MSDN docs say about the handle: > > A handle to the window whose update region has changed. If this parameter is NULL, the system invalidates and redraws all windows, not just the windows for this application, and sends the WM_ERASEBKGND and WM_NCPAINT messages before the function returns. Setting this parameter to NULL is not recommended. > > So I would look for WM_ERASEBKGND, WM_NCPAINT > > > Robert > >> this line below takes up one GDI object within bbrowser >> >> InvalidateRect(self:Handle(), ptr(_cast, @self:srcCaptionArea), False) >> >> >> On 24/10/2017 16:56, Martin wrote: >>> Found it in some code we inherited to do with column titles >>> >>> 1 object lost in redrawing a column title. >>> SELF:Redraw(#CAPTION) >>> >>> >>> 10 in refreshing the browser. >>> SELF:Refresh() >>> >>> >>> Will now drop debugs into the bbrowser code to find the leaks >>> >>> >>> On 24/10/2017 14:27, Martin wrote: >>>> Hello All >>>> >>>> I am going through a program which is left running over night and >>>> occasionally runs out of GDI resources. >>>> >>>> I have fixed one 3 object leak as I forgot a ReleaseDC in two very >>>> similar classes. >>>> >>>> During a load or a refresh I do call ApplicationExec to keep the >>>> screen from freezing, but at one call I lose 1 GDI object and another >>>> 9 GDI objects. >>>> >>>> I will experiment with removal, but any ideas why it would go up? >>>> >>>> Thanks >>>> >>>> Martin >>> >
[toc] | [prev] | [next] | [standalone]
| From | "Karl-Heinz" <invalid@invalid.invalid> |
|---|---|
| Date | 2017-10-25 12:21 +0200 |
| Message-ID | <f5b6utF1rhhU1@mid.individual.net> |
| In reply to | #11083 |
Hi Martin, > this line below takes up one GDI object within bbrowser > > InvalidateRect(self:Handle(), ptr(_cast, @self:srcCaptionArea), False) as Robert said: InvalidateRect() declares a given rectangle area as invalid and in addition triggers a WM_PAINT msg, so check what´s happening during the paint. To ensure that no longer used VO Objects like bitmaps etc. are cleaned up as soon as possible trigger the GC manually: if ! incollect() collectforced() endif ... now check the number of GDI objects in use. ... regards Karl-Heinz
[toc] | [prev] | [next] | [standalone]
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2017-10-31 11:58 +0000 |
| Message-ID | <ot9ohj$ji2$2@dont-email.me> |
| In reply to | #11085 |
It wasn't the problem but pointed me to it. Fixing some pretty well hidden GDI object leaks was a very interesting project. On 25/10/2017 11:21, Karl-Heinz wrote: > Hi Martin, > >> this line below takes up one GDI object within bbrowser >> >> InvalidateRect(self:Handle(), ptr(_cast, @self:srcCaptionArea), False) > > as Robert said: > > InvalidateRect() declares a given rectangle area as invalid and in > addition triggers a WM_PAINT msg, so check what´s happening during the > paint. To ensure that no longer used VO Objects like bitmaps etc. are > cleaned up as soon as possible trigger the GC manually: > > if ! incollect() > collectforced() > > endif > > ... > > now check the number of GDI objects in use. > > ... > > regards > Karl-Heinz
[toc] | [prev] | [next] | [standalone]
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2017-10-25 09:19 +0100 |
| Message-ID | <osphf1$out$1@dont-email.me> |
| In reply to | #11083 |
Guess what? a font! Only 10 to go now On 24/10/2017 17:00, Martin wrote: > this line below takes up one GDI object within bbrowser > > InvalidateRect(self:Handle(), ptr(_cast, @self:srcCaptionArea), False) > > > On 24/10/2017 16:56, Martin wrote: >> Found it in some code we inherited to do with column titles >> >> 1 object lost in redrawing a column title. >> SELF:Redraw(#CAPTION) >> >> >> 10 in refreshing the browser. >> SELF:Refresh() >> >> >> Will now drop debugs into the bbrowser code to find the leaks >> >> >> On 24/10/2017 14:27, Martin wrote: >>> Hello All >>> >>> I am going through a program which is left running over night and >>> occasionally runs out of GDI resources. >>> >>> I have fixed one 3 object leak as I forgot a ReleaseDC in two very >>> similar classes. >>> >>> During a load or a refresh I do call ApplicationExec to keep the >>> screen from freezing, but at one call I lose 1 GDI object and another >>> 9 GDI objects. >>> >>> I will experiment with removal, but any ideas why it would go up? >>> >>> Thanks >>> >>> Martin >> >
[toc] | [prev] | [next] | [standalone]
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2017-10-25 10:54 +0100 |
| Message-ID | <ospn18$v29$1@dont-email.me> |
| In reply to | #11081 |
Found that anything browse tends to take up GDI objects but does not always release, but closing the screen and rerunning uses the same objects again. So NOT a problem. Now the fun, we use a modified Willie Moores SLE classes including the date picker, and I have found it leaks one GDI object each time the calendar is popped up. Time to dig deeper! On 24/10/2017 14:27, Martin wrote: > Hello All > > I am going through a program which is left running over night and > occasionally runs out of GDI resources. > > I have fixed one 3 object leak as I forgot a ReleaseDC in two very > similar classes. > > During a load or a refresh I do call ApplicationExec to keep the screen > from freezing, but at one call I lose 1 GDI object and another 9 GDI > objects. > > I will experiment with removal, but any ideas why it would go up? > > Thanks > > Martin
[toc] | [prev] | [next] | [standalone]
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2017-10-25 12:00 +0100 |
| Message-ID | <ospqrv$q42$1@dont-email.me> |
| In reply to | #11094 |
Last changed 2009, not sure where the pen used came from, if it was me, or someone else, but a delete object fixes it. On 25/10/2017 10:54, Martin wrote: > Found that anything browse tends to take up GDI objects but does not > always release, but closing the screen and rerunning uses the same > objects again. > > So NOT a problem. > > Now the fun, we use a modified Willie Moores SLE classes including the > date picker, and I have found it leaks one GDI object each time the > calendar is popped up. > > Time to dig deeper! > > On 24/10/2017 14:27, Martin wrote: >> Hello All >> >> I am going through a program which is left running over night and >> occasionally runs out of GDI resources. >> >> I have fixed one 3 object leak as I forgot a ReleaseDC in two very >> similar classes. >> >> During a load or a refresh I do call ApplicationExec to keep the >> screen from freezing, but at one call I lose 1 GDI object and another >> 9 GDI objects. >> >> I will experiment with removal, but any ideas why it would go up? >> >> Thanks >> >> Martin >
[toc] | [prev] | [next] | [standalone]
| From | Arne Ortlinghaus <Arne.Ortlinghaus@acs.it> |
|---|---|
| Date | 2017-10-27 17:05 +0200 |
| Message-ID | <osvhvs$1ch$1@gioia.aioe.org> |
| In reply to | #11094 |
The bbrowser generates many GDI objects, that are not destroyed by the
program, but are destroyed when they are removed by the Garbage
Collector. I have inserted some code that checks the User and GDI
objects regularly and calls the Garbage Collector explicitly if the
number is near. This helped.
Initialization:
snMaxResourcesUserObjects := ;
QueryRegInt (HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Windows", "USERProcessHandleQuota", 0)
snMaxResourcesGDIObjects :=;
QueryRegInt (HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Windows", "GDIProcessHandleQuota", 0)
if snMaxResourcesUserObjects == 0
snMaxResourcesUserObjects:= 10000
endif
snMaxResourcesUserObjects := snMaxResourcesUserObjects*8 / 10
if snMaxResourcesGDIObjects = 0
snMaxResourcesGDIObjects := 10000
endif
snMaxResourcesGDIObjects := snMaxResourcesGDIObjects*8 / 10
Check:
if GetGuiResources(GetCurrentProcess(),GR_USEROBJECTS) >
snMaxResourcesUserObjects
CollectForced()
endif
if GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS) >
snMaxResourcesGDIObjects
CollectForced()
endif
Arne Ortlinghaus
Martin wrote:
> Found that anything browse tends to take up GDI objects but does not
> always release, but closing the screen and rerunning uses the same
> objects again.
>
> So NOT a problem.
>
> Now the fun, we use a modified Willie Moores SLE classes including the
> date picker, and I have found it leaks one GDI object each time the
> calendar is popped up.
>
> Time to dig deeper!
>
> On 24/10/2017 14:27, Martin wrote:
>> Hello All
>>
>> I am going through a program which is left running over night and
>> occasionally runs out of GDI resources.
>>
>> I have fixed one 3 object leak as I forgot a ReleaseDC in two very
>> similar classes.
>>
>> During a load or a refresh I do call ApplicationExec to keep the
>> screen from freezing, but at one call I lose 1 GDI object and another
>> 9 GDI objects.
>>
>> I will experiment with removal, but any ideas why it would go up?
>>
>> Thanks
>>
>> Martin
>
[toc] | [prev] | [next] | [standalone]
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2017-10-31 11:57 +0000 |
| Message-ID | <ot9og3$ji2$1@dont-email.me> |
| In reply to | #11099 |
I had a very interesting learning experience with this, fixed two leaks, one 10 years old, 1 a year old. I already have some clearing routines, but did need to fix the leak. On 27/10/2017 16:05, Arne Ortlinghaus wrote: > The bbrowser generates many GDI objects, that are not destroyed by the > program, but are destroyed when they are removed by the Garbage > Collector. I have inserted some code that checks the User and GDI > objects regularly and calls the Garbage Collector explicitly if the > number is near. This helped. > > Initialization: > snMaxResourcesUserObjects := ; > QueryRegInt (HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows > NT\CurrentVersion\Windows", "USERProcessHandleQuota", 0) > snMaxResourcesGDIObjects :=; > QueryRegInt (HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows > NT\CurrentVersion\Windows", "GDIProcessHandleQuota", 0) > if snMaxResourcesUserObjects == 0 > snMaxResourcesUserObjects:= 10000 > endif > snMaxResourcesUserObjects := snMaxResourcesUserObjects*8 / 10 > > if snMaxResourcesGDIObjects = 0 > snMaxResourcesGDIObjects := 10000 > endif > snMaxResourcesGDIObjects := snMaxResourcesGDIObjects*8 / 10 > > > Check: > if GetGuiResources(GetCurrentProcess(),GR_USEROBJECTS) > > snMaxResourcesUserObjects > CollectForced() > endif > if GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS) > > snMaxResourcesGDIObjects > CollectForced() > endif > > > Arne Ortlinghaus > > > Martin wrote: >> Found that anything browse tends to take up GDI objects but does not >> always release, but closing the screen and rerunning uses the same >> objects again. >> >> So NOT a problem. >> >> Now the fun, we use a modified Willie Moores SLE classes including the >> date picker, and I have found it leaks one GDI object each time the >> calendar is popped up. >> >> Time to dig deeper! >> >> On 24/10/2017 14:27, Martin wrote: >>> Hello All >>> >>> I am going through a program which is left running over night and >>> occasionally runs out of GDI resources. >>> >>> I have fixed one 3 object leak as I forgot a ReleaseDC in two very >>> similar classes. >>> >>> During a load or a refresh I do call ApplicationExec to keep the >>> screen from freezing, but at one call I lose 1 GDI object and another >>> 9 GDI objects. >>> >>> I will experiment with removal, but any ideas why it would go up? >>> >>> Thanks >>> >>> Martin >> >
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web