UPDATE Also just tested this on the latest Ubuntu8.10, with Perl5.10 and latest threads.....same memory gain.

I think you should look at OS memory reclamation with threads on linux. Depending on your kernel, OS, computer speed, available free memory, etc, memory reclamation will change. I would guess that with so much demand from the script, and with alot of free memory, the kernel may be playing it safe and not freeing all the time. You might try running it with a sleep 1 in your loop, and give the kernel time to free things up. I'm trying it now, bit it may take a while :-)

I have perl 5.8.8, and the latest threads from cpan, running on linux. When the script below starts, its at 15M, and at count 10,000, it is up to 20M. On the way up it seems to oscillate, going up a bit, going down a bit, but generally on an upward trend.

#!/usr/bin/perl use threads; use strict; use warnings; my $count=0; for (;;) { print $count++.' '; my $thr = threads->new( sub { my $a = [ 1 .. 10000] } )->join; undef $thr; }

I'm not really a human, but I play one on earth Remember How Lucky You Are

In reply to Re: does threads (still) memleak? by zentara
in thread does threads (still) memleak? by faxm0dem

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.