Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Perl Threads and Memory Leaking

by BrowserUk (Patriarch)
on Oct 06, 2009 at 06:37 UTC ( [id://799390]=note: print w/replies, xml ) Need Help??


in reply to Perl Threads and Memory Leaking

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://799390]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 05:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found