in reply to Memory leak!

The first thing I notice is that the code you posted will not even compile. You have a missing close brace:

sub ftpFileGet { my $workingDir = $globals[2]{'workingDir'}; my $select = Net::Netrc->lookup($host, $userAcct); my $pass = $select->password(); my $ftp = Net::FTP->new($host); $ftp->login($userAcct, $pass); $ftp->pasv; $ftp->binary; chdir($workingDir); foreach my $fileToGet (@matches) { $ftp->cwd("$remoteDir"); my $remoteFileSize = $ftp->size($fileToGet); my $localFileName = "$fileToGet"."$globals[1]{'transfer'}"; my $ftpReturnVar = $ftp->get($fileToGet, $localFileName); next if ! defined $ftpReturnVar; my $localFileSize = (stat "$workingDir/$localFileName")[7]; if ($remoteFileSize == $localFileSize) { push (@filesToRetrv, $ftpReturnVar); ## <<<<<<<<<<<<<<<<<<<<<<< Guess what is missing here!! } $ftp->quit(); return @filesToMove; }


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^2: Memory leak!
by joeymac (Acolyte) on Dec 12, 2011 at 19:20 UTC

    Sorry, that closing brace must have gone to the way side while I was trying to clean up the script to post here. The full code does, in fact, compile. As I said, it runs for about an hour before ending with the "Out of memory!" message.