CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced: Re: [budman] Release memory from threads: Edit Log



budman
User

Mar 14, 2012, 12:26 AM


Views: 9772
Re: [budman] Release memory from threads

You can check if there was an error with a thread when its detached.


Code
 
$t->detach;
if ( my $err = $t->error() ) { print "Error: $err\n" }


This will force the thread to be evaled and report any errors if they occur.

What version of Perl are you using?
It's recommended you use 5.12 or newer due to the many bug fixes applied for threads (There was one for memory leak).

Here is a test script to test for memory leaks in threads:
https://bugzilla.redhat.com/attachment.cgi?id=442606
May need to adapt it to Windows. I don't know how to grab stat for memory, other than the DOS mem command. Maybe there is a module for Win32.



I tested it under 5.14, no leaks detected.


(This post was edited by budman on Mar 14, 2012, 12:50 AM)


Edit Log:
Post edited by budman (User) on Mar 14, 2012, 12:45 AM
Post edited by budman (User) on Mar 14, 2012, 12:50 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives