Memory consumption seems to grow for Perl 5.8.8 running on Debian Etch as well.

use strict; use warnings; use Thread; use Time::HiRes qw(usleep); my $count = 0; print " VIRT RES SHR S %CPU %MEM TIME+\n"; while( 1 ) { usleep(100); my $thr1 = new Thread \&doNothing; $thr1->join; unless( ++$count % 1000 ) { printf "%-10s%4s %3s %3s %s %4s %4s %s\n" , "$count: " , map { s/^\s+//; (split(/\s+/,$_,-1))[4..10] } grep {/^\s*$$/} qx{top -n 1 -p $$ -b}; } } sub doNothing {} __END__ VIRT RES SHR S %CPU %MEM TIME+ 1000: 13536 3784 1488 S 0.0 1.5 0:01.03 2000: 14256 4504 1492 S 0.0 1.8 0:11.59 3000: 14980 5220 1492 S 0.0 2.0 0:12.27 4000: 15700 5936 1492 S 0.0 2.3 0:20.39 5000: 16420 6652 1492 S 0.0 2.6 0:30.56 6000: 17144 7368 1492 S 0.0 2.9 0:40.29 7000: 17864 8084 1492 S 0.0 3.2 0:41.38 8000: 18504 8800 1492 S 0.0 3.4 0:42.78 9000: 19224 9516 1492 S 0.0 3.7 0:46.31 10000: 19944 9m 1492 S 0.0 4.0 0:50.17 11000: 20664 10m 1492 S 0.0 4.3 0:52.94 12000: 21388 11m 1492 S 0.0 4.5 0:53.33 13000: 22108 12m 1492 S 0.0 4.8 0:54.48 14000: 22828 12m 1492 S 0.0 5.1 1:00.93 15000: 23552 13m 1492 S 0.0 5.4 1:13.55 16000: 24272 14m 1492 S 0.0 5.7 1:23.45 17000: 24992 14m 1492 S 0.0 5.9 1:30.25 18000: 25712 15m 1492 S 0.0 6.2 1:30.35 19000: 26432 16m 1492 S 0.0 6.5 1:38.96 20000: 27152 16m 1492 S 0.0 6.8 1:49.57 21000: 27872 17m 1492 S 0.0 7.1 1:59.23 22000: 28592 18m 1492 S 2.0 7.3 1:59.82 23000: 29312 19m 1492 S 0.0 7.6 2:02.34 24000: 29956 19m 1492 S 0.0 7.9 2:09.54 25000: 30676 20m 1492 S 0.0 8.2 2:18.27 26000: 31396 21m 1492 S 0.0 8.5 2:21.90 27000: 32116 21m 1492 S 0.0 8.7 2:30.96 28000: 32836 22m 1492 S 0.0 9.0 2:33.76 29000: 33556 23m 1492 S 0.0 9.3 2:34.37 30000: 34276 23m 1492 S 0.0 9.6 2:37.70 31000: 34996 24m 1492 S 2.0 9.9 2:46.51 32000: 35716 25m 1492 S 0.0 10.1 2:56.34 33000: 36436 26m 1492 S 0.0 10.4 3:06.34 34000: 37156 26m 1492 S 0.0 10.7 3:14.56 35000: 37876 27m 1492 S 0.0 11.0 3:22.40 ... 163000: 126m 116m 1492 S 2.0 46.7 16:06.57 164000: 127m 117m 1492 S 0.0 47.0 16:08.22

Best, beth

Update Modified code so that number of fields in top output is consistent (leading spaces were making some runs start w/ field 4 and some with field 5).


In reply to Re: Perl Threads and Memory Leaking by ELISHEVA
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.