1. Re[2]: win32lib v0.57.4 released

------------FC1B1E13CD925FD

> Thomas Parslow (PatRat) wrote:
>> > - "by Thomas Parslow". GDI resource leak using wPuts and queryFont 
>> > removed.
>> 
>> Hi,
>> 
>> This bug still seems to be present, applying the fix I posted before
>> still works though...
>> 
>>
>> http://www.rapideuphoria.com/cgi-bin/esearch.exu?fromMonth=4&fromYear=7&toMonth=4&toYear=7&postedBy=thomas+parslow&keywords=queryFont+wPuts
>> 
>> 

> That's weird Thomas. I tested it and got no resource leakage. Maybe my 
> testing process is flawed. How exactly are you seeing the resource 
> leakage? 
> As for your fix, yes it worked  but I needed a more generic way of doing 
> it, so I adapted your code to catch all font leaks, now and in the 
> future. (Or so I thought).
> -----------
> Derek.

Hi,

I've attached a test program which demonstrates the problem (using
wPuts, it's exactly the same with queryFont). I'm noticing it by
watching the Task Manager (set to show GDI object usage).

I'm using windows XP here so maybe that would explain the difference
if you still don't see the problem...

Thomas Parslow (PatRat)
E-Mail/Jabber: tom at almostobsolete.net
ICQ: 26359483
------------FC1B1E13CD925FD
Content-Type: application/octet-stream; name="resourceleak.exw"

new topic     » topic index » view message » categorize

2. Re: Re[2]: win32lib v0.57.4 released

Since  Derek's  'away"...
> >> > - "by Thomas Parslow". GDI resource leak using wPuts and queryFont 

Does this example trash XP as nicely !  ...as it does Win98 ?
Just *minimize* after running !
( 'hard' reboot may be req.  ...if you run it a few times...   :(  )
Works OK using 0.55.5.
----
include win32lib.ew
constant
blank=create(Window,"",0,10,10,300,200,0)
setWindowBackColor(blank,BrightWhite)
procedure draw(integer i)
if remainder(i,2) then setPenColor(blank,Blue)
else setPenColor(blank,Red) end if
drawRectangle(blank,1,1,1,99,99)
end procedure
showWindow(blank,1)
for i = 1 to 20000 do
draw(i)
end for
WinMain(blank,Normal)
----

new topic     » goto parent     » topic index » view message » categorize

3. Re: Re[2]: win32lib v0.57.4 released

----- Original Message -----
From: "Wolf" <wolfritz at KING.IGS.NET>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Re[2]: win32lib v0.57.4 released


>
> Since  Derek's  'away"...
> > >> > - "by Thomas Parslow". GDI resource leak using wPuts and queryFont
>
> Does this example trash XP as nicely !  ...as it does Win98 ?
> Just *minimize* after running !
> ( 'hard' reboot may be req.  ...if you run it a few times...   :(  )
> Works OK using 0.55.5.
> ----
> include win32lib.ew
> constant
> blank=create(Window,"",0,10,10,300,200,0)
> setWindowBackColor(blank,BrightWhite)
> procedure draw(integer i)
> if remainder(i,2) then setPenColor(blank,Blue)
> else setPenColor(blank,Red) end if
> drawRectangle(blank,1,1,1,99,99)
> end procedure
> showWindow(blank,1)
> for i = 1 to 20000 do
> draw(i)
> end for
> WinMain(blank,Normal)
> ----

Okay, what was happening is that drawRectangle(), as did many other
routines, assume that it was running from an onPaint event handler.
Win32lib automatically releases all the resources after a Paint event
handler completes.  In your example above, the code is not running inside a
Paint event handler so it never tries to clean up.

I've fixed this now so that those routines that grab resources, expecting
them to be freed up by the end of a Paint event handler, will free them
themselves if NOT being run inside a paint handler.

Also, I've made releasePaintResources() and releaseResourcesForID() as a
global procedures so that you can 'manually' call them if you are having
other resource leak issues.

---------
Derek.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Re[2]: win32lib v0.57.4 released

> Okay, what was happening is that drawRectangle(), as did many other
> routines, assume that it was running from an onPaint event handler.

Hi Derek.
I was plotting a multi-color graph onto a pixmap, which was only copyBlt()'ed to
a display window whenever it was made
visible, so onPaint[] for a pixmap never occurred to me.

Have you given up on your 'proof-of-concept' version 0.56 altogether ?
While I thought that so many little includes were going overboard, it might have
been nice to see the listview /
treeview stuff as a single separate, since it's a huge chunk of code/constants
that's not required in most simple
programs.

Obviously not as important as it used to be, with the new 'bind' stripper.

Thanks ... Wolf

new topic     » goto parent     » topic index » view message » categorize

5. Re: Re[2]: win32lib v0.57.4 released

----- Original Message -----
From: "Thomas Parslow (PatRat)" <tom at almostobsolete.net>
To: "EUforum" <EUforum at topica.com>
Subject: Re[2]: win32lib v0.57.4 released


>
> > Thomas Parslow (PatRat) wrote:
> >> > - "by Thomas Parslow". GDI resource leak using wPuts and queryFont
> >> > removed.
> >>
> >> Hi,
> >>
> >> This bug still seems to be present, applying the fix I posted before
> >> still works though...
> >>
> >>
http://www.rapideuphoria.com/cgi-bin/esearch.exu?fromMonth=4&fromYear=7&toMo
nth=4&toYear=7&postedBy=thomas+parslow&keywords=queryFont+wPuts
> >>
> >>
> > That's weird Thomas. I tested it and got no resource leakage. Maybe my
> > testing process is flawed. How exactly are you seeing the resource
> > leakage?
> > As for your fix, yes it worked  but I needed a more generic way of doing
> > it, so I adapted your code to catch all font leaks, now and in the
> > future. (Or so I thought).
> > -----------
> > Derek.
>
> Hi,
>
> I've attached a test program which demonstrates the problem (using
> wPuts, it's exactly the same with queryFont). I'm noticing it by
> watching the Task Manager (set to show GDI object usage).
>
> I'm using windows XP here so maybe that would explain the difference
> if you still don't see the problem...
>

Thanks Thomas,
this is the same problem as with drawRectangle() leak. Both wPuts() and
queryFont() assumed they were being run inside a Paint event handler. I've
fixed now so they don't always assume that.
----------
Derek.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Re[2]: win32lib v0.57.4 released

----- Original Message -----
From: "Wolf" <wolfritz at KING.IGS.NET>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Re[2]: win32lib v0.57.4 released


>
> > Okay, what was happening is that drawRectangle(), as did many other
> > routines, assume that it was running from an onPaint event handler.
>
> Hi Derek.
> I was plotting a multi-color graph onto a pixmap, which was only
copyBlt()'ed to a display window whenever it was made
> visible, so onPaint[] for a pixmap never occurred to me.

Yeah, I figure that as this "feature" was not documented, no one would have
realized the dependancy between these functions and Paint events. Hopefully
I've removed that dependancy now.

> Have you given up on your 'proof-of-concept' version 0.56 altogether ?
> While I thought that so many little includes were going overboard, it
might have been nice to see the listview /
> treeview stuff as a single separate, since it's a huge chunk of
code/constants that's not required in most simple
> programs.
>
> Obviously not as important as it used to be, with the new 'bind' stripper.

No I haven't given up on the idea. The "concept" version taught me many
things. I've decided to get the library stable first. And by stable I mean
no more than one bug per week that has to be fixed. We are getting near
that.

I will transform it to a file-per-control type of library but that is on
hold for now.

-----------
Derek.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu