Hello!

I use windows XP, Windows 7 and win32::GUI 1.06. Problem exists on the both 
OS`s.

It is not problem with win32::GUI but I experienced it just using the module 
in my application.

My application dynamically generates series of windows (potentially 
unlimited). Each of those is full Win32::GUI object with all the staf: 
buttons, labels, textfields and so on. Now, the windows can be opened as 
cascades of the windows so, normally full working application has 100-300 
different windows but at one time there can be about 10-20 windows
simultaniously. Therefore I need a memory only for the 10-20 windows 
potentialy. The problem I have is the fact that my application can not use the 
memory again, so in a relativaly short time memory run out and application 
stops usually with strange colors on the desktop.

Here is the perl script which shows the problem. On my machine the error of 
"Out of memmory" appeared after a little over 4000 iteration - it depends on 
the machine. Not always this writing happens - very often just stops with 
strange background colors (black for the example).

My question: Does anybode can show me how I could use the memory of deleted 
objects again? Please look at the example: The address of the object is going 
up and up... How to stop it? In the code I just delete the object so it is 
obvious that the memmory is free for reusing. Strange enough is the fact that 
the object which contains internal GUI window objects got the same address.
What is going on? I was searching the Internet but not succeded - althoug they 
say in this area Perl sucks. Maybe Perl is not good tool for 'really' big or 
long working applications because of practical leak of memory?

Regards 
Waldemar

##########################
use strict;
use warnings;

use Win32::GUI qw();

my $i = 0;

while ( $i < 50 ) {
        $i++;
                                    
        my $ch = pakiet1->start( $i );

        print "$i:\t",$ch,"\t",$ch->{item},"\n";

        $ch->{item}->DESTROY;
        undef $ch->{item};
        undef $ch;
        print "\t\t\t",$ch if $ch;
        print "\t\t\t",$ch->{item} if $ch->{item};
        print "\n";
}

########################
package pakiet1;

sub start {
        my ( $self, $i ) = @_;
        my $this = {};
        bless ( $this, $self );

        $this->{item} = new Win32::GUI::Window(
            -name   => "ch",
                -text   => "window",
                -size   => [ 200, 200 ],
                -pos    => [ 400, 400 ],
                -visible=> 0,
        );
        for ( my $i = 0 ; $i < 400 ; $i++ ) {
                $this->{item}-> AddLabel(
                -name   => "labe_$i",
                        -text   => "label-$i",
                        -size   => [ 180,  20 ],
                        -pos    => [  10,  50 ],
                );
        }
        return $this;
}

1;
__END__

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
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