On win, I see a slow creep up of memory usage for the first few thousand iterations, but it then stabilises and stays rock steady for tens of thousands more:

#!/usr/bin/perl use Thread; use Time::HiRes qw(usleep); my $count = 0; while( 1 ) { usleep(100); my $thr1 = new Thread \&doNothing; $thr1->join; unless( ++$count % 1000 ) { printf "%3d: %s", $count, ( qx[tasklist /fo list /fi "pid eq $$"] )[ 5 ]; } } sub doNothing {} __END__ C:\test>junk 1000: Mem Usage: 11,576 K 2000: Mem Usage: 11,752 K 3000: Mem Usage: 11,880 K 4000: Mem Usage: 11,944 K 5000: Mem Usage: 12,544 K 6000: Mem Usage: 12,544 K 7000: Mem Usage: 12,544 K 8000: Mem Usage: 12,544 K 9000: Mem Usage: 12,544 K 10000: Mem Usage: 12,544 K 11000: Mem Usage: 12,544 K 12000: Mem Usage: 12,544 K 13000: Mem Usage: 12,544 K 14000: Mem Usage: 12,544 K 15000: Mem Usage: 12,544 K 16000: Mem Usage: 12,544 K 17000: Mem Usage: 12,544 K 18000: Mem Usage: 12,544 K 19000: Mem Usage: 12,544 K 20000: Mem Usage: 12,544 K 21000: Mem Usage: 12,544 K 22000: Mem Usage: 12,544 K 23000: Mem Usage: 12,544 K 24000: Mem Usage: 12,544 K 25000: Mem Usage: 12,544 K 26000: Mem Usage: 12,544 K 27000: Mem Usage: 12,544 K 28000: Mem Usage: 12,544 K 29000: Mem Usage: 12,544 K 30000: Mem Usage: 12,544 K 31000: Mem Usage: 12,544 K 32000: Mem Usage: 12,544 K 33000: Mem Usage: 12,544 K Terminating on signal SIGINT(2)

If there's a leak, it appears to be platform specific.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW It is as I've been saying!(Audio until 20090817)

In reply to Re: Perl Threads and Memory Leaking by BrowserUk
in thread Perl Threads and Memory Leaking by aphexcoil

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.