Have an application I inherited that takes a file FTPed from another internal company server (actually OS/390) that can be quite large and contain hundreds of separate sub-files that I split out and mail out as gzipped attachments.

Problem is, when the file is very large (well that is all relative, but ~200-800M is what I'm talking about) and at some point, "system" calls (used to do "mv" and "gzip"...) fail with -1 and/or memory usage is sucked out of the box (HPUX 11). Each splitout file will be compressed and emailed (using Net::SMTP::Multipart though in new reengineered process, I chose MIME::Lite for the job...), then removed. At process end, the original fileset is moved and compressed also.

Since the process did not "use strict; use warnings" and was not properly constructed for failover & recovery (critical since mail relay server is on an entirely different host now..), I've rewritten the process as 2 separate scripts and a library routine. It's handled the volume and stress like a charm until I plug back in system calls (as opposed to a ksh to call the perl script for each splitout directory entry). This modification brought my machine to its knees, though it recoverd, but for a spout of 10 minutes, memory was exhausted.

Question to those of you Perl powers of higher accordance and blessings - how can this "system" call memory link be abated or even diagnosed? I've changed calls using 'system "rm ..."' to unlink but would it also serve better performance if I used a library like Compress::Zlib instead of 'system "gzip ..."' calls?


In reply to How to find a memory leak - appears to be "system" calls that are responsible by naum

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.