Hi!
Now I've got another problem. Memory one.

Here is an application that make ten windows if you press right arrow key and destroy them if you press left arrow key. After I create 10 windows Windows Task Menager reads that perl is using 6704K memory (I use WinXPHE sp2). This is maximal number of windows, nothing more! But - after a while - if you try to press these arrows then amount of used memory will rise. Meantime I am writing the email after about 20 arrows I have 6752K memory.... next - after running some other programs - I have 6800K now (100K more and this a very simple application!). Now I have 6820K hmmm... where is the end? It seems to be connected with other processes/programs when they startet or ended (6860K).

Could someone help me and answer the questions:
1. has attached application errors (what)
2. Is that memory problem normal feature in perl (maybe perl problems with OO programming?)
3. Maybe it's connected only with Perl/Windows?
4. Or maybe Perl modules are dirty written?

any comments are very usefull!

ps.I'm finishing writing with the value of 2896K...

########################################################
#! c:\Perl\bin\perl.exe -w

use strict;
use warnings;

use Win32::GUI qw();

my @Window;
my $which =  0;
my $max   = 10;
my $last  = -1;

makewindow();

Win32::GUI::Dialog();

exit 0;

sub makewindow {
   return 1 if $last > $max - 2;

   $last++;

   $Window[$last]{SCREEN} = new Win32::GUI::Window (
       -title => "Window: ".($last+1),
       -pos   => [20+$last*120, 200],
       -size  => [100, 300],
       -name  => "Window_$last",
       -onKeyDown => \&keydown,
   );

   $Window[$last]->{SCREEN}->Show(1);

   print "window $last created\n";

   $which = $last;
}

sub keydown {
   my ( $self, undef, $key ) = @_;
   return 0 unless $key;
   if ( $key == 39 ) {
       makewindow();
   } elsif ( $key == 37 ) {
       if (( $which == $last )&&( $last>0)) {
           print "window $last deleted\n";
           $Window[$which]{SCREEN}->DESTROY;
           $last--;
           $which--;
           $Window[$which]{SCREEN}->SetFocus();
       }
   }
   return 1;
}
__END__
########################################################

Reply via email to