No idea what causes it either, but it's clearly a split issue, since @X isn't even needed, although as others point out a my @X fixes it. Warped! (Although come to think of it, not using @X just makes perl use @_, so this may not mean much...)
#!/usr/bin/perl # ## To burn up memory quickly, run this with option "death". $option = shift; if ($option eq "death") { $line = "1::"; } else { $line = "1:"; } my $i=1; while (1) { split(/:/, $line); # this sucks up memory too if you replace that line with # these 2 #@X = split(/:/, $line); #@X = (); if(!($i++%3000000)) { # a good place to break point print "$i\n"; } }

--
Mike

In reply to You don't even need @X by RMGir
in thread Perl memory leak? by mnperez

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.