Hello all.

I create small script, which download several files with 4-8 Mb size from ftp with Net::FTP module.

Running on Debian 7.5 it takes only 5 Mb memory. But on Windows 7 memory usage is 230 Mb! I try to test on another Windows 7 machine with latest version of perl and ftp-module, but it takes the same memory.

I want to know why this happens and how to reduce the memory usage?

use warnings; use feature 'say'; use Net::FTP; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my $ftp = Net::FTP->new('mirror.ufs.ac.za', Debug => 0, Passive => 1, +BlockSize => 104857600); $ftp->login('anonymouse', 'anon@nymo.use'); $ftp->binary; $ftp->cwd('/applications/filezilla/FileZilla_Client/3.9.0.6/'); foreach my $line ($ftp->dir()) { eval { if ($line =~ /^(?<dir>[\-ld])(?<permission>([\-r][\-w][\-xs]){ +3})\s+(?<filecode>\d+)\s+(?<owner>\w+)\s+(?<group>\w+)\s+(?<size>\d+) +\s+(?<timestamp>((?<month>\w{3})\s+(?<day>\d{1,2})\s+(?<hour>\d{1,2}) +:(?<minute>\d{2}))|((?<month2>\w{3})\s+(?<day2>\d{1,2})\s+(?<year>\d{ +4})))\s+(?<name>.+)$/) { my %remote_file_info = %+; if ($remote_file_info{dir} eq '-') { if ($ftp->get($remote_file_info{name}, 'files/' . $rem +ote_file_info{name})) { } else { die($ftp->message); } } } }; if ($@) { say($@); } } $ftp->quit; undef($ftp);

In reply to Net::FTP memory usage in Windows by artem78

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.