Jeremy I've forgotten to send it to the list so it is the second copy...

Dnia środa, 23 marca 2011 o 11:22:52 napisałeś:
> > > Vista and Windows 7 have larger default values, but you really need to
> > > work out why you are using so many GDI objects. It shouldn't be that
> > > high...
> > 
> > I use about 1000 them in my biggest window - it is a table 12x20 of
> > textfields plus their borders (I do them independently - I wanted to
> > have them in color and of various width), some buttons width pictures on
> > them, that's it. All my window cascade can have about 2000-3000 GUI
> > objects maximum..
> 
> Could you send me a screenshot of this window so I can understand? Text
> fields shouldn't use any GDI handles. So you draw your own boarders? Do
> you reuse objects?

Probably I am mixing something. I wrote another variant of the script: 
test.pl:
##########################################
#!/usr/bin/perl -w
use strict;
use warnings;
use Win32::GUI qw();
my $i = 0;
while ( $i < 100 ) {    $i++;
{                                    
        my $ch = Win32::GUI::Window->new(
                -name   => "ch1",
                -text   => "child window",
                -pos    => [ 100+10*$i %800,  50 ],
                -size   => [ 300           , 250 ],
                -background=>0xffaaff,
        );
        for ( my $j = 0; $j < 1000; $j++ ) {
                $ch->{"lab_$j"} = $ch->AddLabel(
                        -name   => 'ch1_'.$j,
                        -text   => 'ch1_'.$j,
                        -pos    => [  10, 0 ],
                        -size   => [ 300,  50 ],
                        -background=>0xff00ff,
                );
        }
        $ch->Show();
        print "$i:\t",$ch,"\n";
        undef $ch;
}
}

$i=0;


Win32::GUI::Dialog();
__END__
#################################

and on the site: http://sao.pl/win32-gui/ are images of my screen. The 
description is here:

The Perl script "test.pl" was performed on my windows XP machine (virtual one, 
but I have the same results on 'true' Windows 7 64 bits host machine (HP 
laptop machine), I put the results from vitual machine because gimp can easier 
catch the result - at least I can do that :) 

Moreover:

The error_1.png shows that there are 52074 GDI objects when the iteration 52 
was performed. Everything is reasnable: 52 iteration steps times 1000 labels 
in each iteration gives 52000. Plus start objects and so on.

The error_2.png is just after catastrophy.

The error_3.png shows after script has finished.

The error_4.png shows that screen refreshing is gradual: task bar is partially 
restored.

Say it something to you?


> I think there was a bug fixed in Perl which is why you are finding the
> problem in some versions and not in others.
But this is conneced only with the memory, NOT with the number of GDI objects.
Besides strange is that in versions 5.8.8 and 5.8.9 (activestate and compiled)
this memory issue does not apear whereas on 5.10th version does.

> GDI objects do auto delete
> when they go out of scope (at least they do for me). 
I thought that in my demo script it should be deleted after each iteration 
step. Maybe my script is errored. Please correct it. It is extremally simple 
so everything can be done!

> I can create millions
> of GDI objects during the run of my application. At this stage, I think
> its a bug in your code or a design issue where you keeping hold of GDI
> objects.
See the upper remark - what there should be corrected?

> In hindsight I would have looked more closely at wxPerl (for cross platform
> support) but I am happy with Win32::GUI. As it's built in C and hits the
> Win32 API directly you can do things that other GUI frameworks can't. I'm
> doing some interesting things with threads that you would struggle to do
> even in C#.

Generally threads are not connected with GUI so other GUI versions in Perl are 
good too. I agree that this additionally graphic libraries in Win32-GUI are 
big advantages of Win32-GUI. But in my case when I do program for every-day 
managing SQL databases by many user simultaniously, the possibility to run 
program on three main systems: Windows, Linux and www-Browser in identical way 
is quite usefull for organizations (write one time and use everywhere). My 
idea seems to by similar to java, but in fact it is not - My goal is to write 
an application using very, very high script language and without any 
compilation of any kind. If you add command to the script the change works at 
once - like writing CGI scripts, but without any risk of errors (in the 
database). Better is to compare my scripts to html not to cgi, but not so long 
in si OK stop it.

> Ok, to solve this we need to find out where and why you are using so many
> GDI handles? Could you send screenshots/examples of your code where you
> draw to the screen?
As I said, point your brawser to http://sao.pl/win32-gui/

Thank you
Waldemar


PS. I've read Aldo remarks very carefully. Thank you! I have found the 
considerations before and already tried to use it but nothing had changed. I 
think that it is a different issue.


------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to