> Finding the GDI objects number was crucial. It was written 10000 and maximum 
> - 
> according Microsoft is 65,536 (for XP). The number is written in registry 
> under the key:
> 
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows 
> NT\CurrentVersion\Windows\GDIProcessHandleQuota

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...
> However problem of reusing undefined objects remains. Now I know that it is 
> not 
> problem with the memory but with deleting graphical objects. 
> 
> Jez I wonder what is a differences between your and my installations of 
> Win32::GUI (and windows) that I have problem with GDI objects number (objects 
> are not deleted) and you not? 

I do a lot of GDI drawing and have no leaking GDI objects (I hope!). As long as 
the object (pen, font etc) goes out of scope after you've used it then the GDI 
handle will be freed. For example, say you do something like this (sudo code):
       my $pen = new Win32::GUI::Pen(            -color => [ rand()*255, 
rand()*255, rand()*255 ],             -width => rand()*5,        );    
%pens{$pen} = $pen;   #do some drawing   undef $pen;
The pen is stored in a global hash, and therefore will never be deleted. 
I also find creating and destroying GDI objects has performance implications 
(Windows not perl) so I tend to store pens, brushes, fonts in objects so I can 
just reuse them. You should be able to reuse GDI objects across windows (as 
long as the window and object were created in the same thread).
> I have checked Perl 5.8.9(829) from 21-01-2011 08:00:46.
> I use also Prima and I do not find version for Perl 5.10 - I have for 5.12 
> (the 
> newest). Is it save to install Win32::GUI from Perl 5.10 in Perl 5.12?

Personally I've always had 'issues' with Perl 5.10.x which is why I have stuck 
with with 5.8.x - I have been meaning to try 5.12 but have never got round to 
it.
Cheers,
jez.                                      
------------------------------------------------------------------------------
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