I copied the Calculator example from the CPAN site and used it as the skeleton for my own program.
I am running my program on a Windows 2000 system and every time a remote system connects to it I can see the memory for the perl process increase about 4K. It acts like maybe the thread that gets started to access the new connection doesn’t get cleaned up for some reason.
What the program does is sit on one of my build machines and allows me to collect information from the machine to get status about builds and to allow me to start a build remotely.
I was wondering if I am doing something wrong since this is my first server/client program.
Time: [Mon Dec 8 16:10:32 2008] Mon Dec 8 16:10:32 2008 : Starti +ng Monitor client Parent session Time: [Mon Dec 8 16:10:51 2008] Client: Recieved input of <sx_4.9. +2.0> <Get_Status> Time: [Mon Dec 8 16:10:51 2008] Check_Build branch:<sx_4.9.2.0> c +:\buildscripts\sx_4.9.2.0\inProgress Time: [Mon Dec 8 16:11:08 2008] Get_Status: SX_4.9.2.0.124.000 5,2 +30,792,704 Passed Thu Dec 4 21:35:48 2008 Time: [Mon Dec 8 16:11:08 2008] Client: Closing Socket and shuttin +g down? Time: [Mon Dec 8 16:11:08 2008] Client: Recieved input of <sx_4.9. +1.0> <Get_Status> Time: [Mon Dec 8 16:11:08 2008] Check_Build branch:<sx_4.9.1.0> c +:\buildscripts\sx_4.9.1.0\inProgress Time: [Mon Dec 8 16:11:19 2008] Get_Status: SX_4.9.1.0.097.000 5,2 +30,268,416 Passed Fri Nov 7 14:28:47 2008 Time: [Mon Dec 8 16:11:19 2008] Client: Closing Socket and shuttin +g down? Time: [Mon Dec 8 16:12:19 2008] Client: Recieved input of <sx_4.9. +2.0> <Get_Status> Time: [Mon Dec 8 16:12:19 2008] Check_Build branch:<sx_4.9.2.0> c +:\buildscripts\sx_4.9.2.0\inProgress Time: [Mon Dec 8 16:12:31 2008] Get_Status: SX_4.9.2.0.124.000 5,2 +18,193,408 Passed Thu Dec 4 21:35:48 2008 Time: [Mon Dec 8 16:12:31 2008] Client: Closing Socket and shuttin +g down? Time: [Mon Dec 8 16:12:31 2008] Check_Build branch:<sx_4.9.1.0> c +:\buildscripts\sx_4.9.1.0\inProgress sub Run ($) { my $DEBUG_LOG="c:\\buildscripts\\Monitor\\Client_log.txt"; my($self) = @_; my($line, $sock); my($result); my($rc); my($command); $sock = $self->{'socket'}; if ($self->{'debug'} eq 'ON') { open(DEBUG,">$DEBUG_LOG"); } while(1) { if (!defined($line = $sock->getline())) { if ($sock->error()) { $self->Error("Client connection error %s",$sock->err +or()); } eventLog("Client: Closing Socket and shutting down?"); $sock->close(); return; } $line =~ s/\s+$//; # Remove CRLF ($L_BRANCH,$command)=split(" ",$line); $U_BRANCH=uc($L_BRANCH); eventLog("Client: Recieved input of <$L_BRANCH> <$command>"); SWITCH: { if ( $command eq "Run_Build") { $result=Run_Build(); + last SWITCH; } if ( $command eq "Check_Build") { $result=Check_Build(); + last SWITCH; } if ( $command eq "Get_Status") { $result=Get_Status(); + last SWITCH; } if ( $command eq "Get_Label") { $result=Get_Last_Build_Lab +el(); last SWITCH; } if ( $command eq "Help") { $result=$help_statement; + last SWITCH; } $result="ERROR: Input did not match expected protocol <$comm +and>\n"; } $rc = printf $sock ("%s\n", $result); if (!$rc) { $self->Error("Client connection error %s", $sock->error()); $sock->close(); return; } } } sub new ($$;$) { my($class, $attr, $args) = @_; my($self) = $class->SUPER::new($attr, $args); if ($self->{'parent'}) { # Called via Clone() $self->{'debug'} = $self->{'parent'}->{'debug'}; } else { # Initial call if ($self->{'options'} && $self->{'options'}->{'debug'}) { $self->{'debug'} = $self->{'options'}->{'debug'} } } if (!$self->{'debug'}) { $self->{'debug'} = 'ON'; } $self; }
In reply to memory leak Issue by hdjoe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |