GentleMonks -

I have a perl program (don't you hate it when people call them 'scripts') that processes thousands of xml files that have been individually tgz compressed.

I have been plagued by apparently random failures during "extract" in Archive::Extract. After hours debugging, I believe that the root cause is apparently inside Cwd::cwd, which is used by Archive::Extract. The cwd() function calls '/bin/pwd' via backticks - this works fine most of the time, but I finally caught a case where it returns undef.

At the time it returns undef, I examined $!, which contained - you guessed it - 'Cannot allocate memory'.

The underlying tgz/xml file DOES process successfully when passed through the program individually, or in a small group of files.

Please advise how to diagnose further, or other recommend steps. UPDATE : Here is the failure I get:

Key 'archive' (filename.gz) is of invalid type for 'Archive::Extract:: +new' provided by main::parse_XML at PerfDBparse.pl line 447 at /usr/share/perl/5.10/Params/Check.pm line 345 Params::Check::check('HASH(0x2a3e660)', 'HASH(0x2a3e5a0)') cal +led at /usr/local/share/perl/5.10.0/Archive/Extract.pm line 227 Archive::Extract::new('Archive::Extract', 'archive', 'FileName +.gz') called at PerfDBparse.pl line 447 main::parse_XML('filename', 'allXML', 288600) called at PerfDB +parse.pl line 131 ...(Truncated, and file names changed to protect the innocent). +..
OS: Linux ManchineName 2.6.28-19-server #64-Ubuntu SMP Wed Aug 18 22:43:50 UTC 2010 x86_64 GNU/Linux

Memory info at time of failure:

dmin [ ~ ]$ free -m total used free shared buffers cac +hed Mem: 1987 1873 114 0 125 +275 -/+ buffers/cache: 1471 515 Swap: 475 33 442
This is the first time I'm dealing with an apparent memory leak. Any known issues ? BTW, I use XML::Bare for XML parsing.

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis


In reply to backticks and 'Cannot allocate memory' by NetWallah

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.