Memory size growing by 4 bytes each iteration of only 11 iterations is pretty scanty evidence of a leak. Perhaps you only posted a minimal test case and you have a larger test case that shows that the leak continues. But it is perfectly reasonable for the above code to grow slightly in memory size until things "settle in".

In contrast, this code:

sub test { $_[0]= 'foo'; } while( 1 ) { test(); }
showed no increase in memory size over the course of about a minute (as well as being a CPU pig). If it were growing 4 bytes per iteration, then it would certainly have been obvious in that amount of time. Of course, this could be because my version of Perl (5.6.0, Win32) is different than yours and your version has a leak and mine doesn't.

A more reasonable test case for you to work with might be:

sub test { $_[0]= 'foo'; } while( 1 ) { for(1..1024) { test(); } sleep( 1 ); }
and to see if your memory size grows 4KB per second for many seconds.

        - tye (but my friends call me "Tye")

In reply to (tye)Re: Perl Memory Leak ?? by tye
in thread Perl Memory Leak ?? by eformat

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.