in reply to Re^5: threads: work crew memory leak
in thread threads: work crew memory leak
That sounds simple and convenient, but threads have state. And if you go around just killing them, you don't give them the opportunity to clean up after themselves and that's where 'mysterious' memory leaks arise.What would be the right way(tm) to kill a hanging thread as far as proper garbage collection goes?
But there are better alternatives to both those approaches. The details depend upon the type of "network related issues" you are concerned about?Basically all the program does is retrieving the RFC 2616 status code of a large number (+500k) of distfiles from various different http/ftp servers using HTTP::Request and LWP::UserAgent.
Setting $ua->timeout(10); deosn't seem to be working at all. I'm now doing:
Not sure if that's the best thing but it seems to work better than setting an LWP timeout.my $code; eval { local $SIG{ALRM} = sub {die "alarm\n"}; alarm $defcfg->{'link_check_timeout'}; # LWP stuff $code= ...; alarm 0; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: threads: work crew memory leak
by BrowserUk (Patriarch) on Oct 18, 2010 at 18:03 UTC | |
by rakzer (Novice) on Oct 19, 2010 at 21:39 UTC |