Forget using Perl's Windows fork emulation. It leaks like a sieve.
See how you get on with this. On my system it settles down to a steady state memory usage after a few cycles:
#! perl -sw use 5.010; use strict; use threads ( stack_size => 4096 ); while( 1 ) { async( \&get_data_and_go )->detach; sleep 5; ## Go get every 5 seconds } sub get_data_and_go { my $tid = threads->tid; require LWP::Simple; ## Requiring prevent CLONE leaks. ##does some webpage stuff and exits my $bytes= length( LWP::Simple::get( 'http://www.yahoo.com' ) ); say "$tid : Got $bytes"; sleep rand 10; ## Simulated variable processing time say "$tid : done"; return 0; };
In reply to Re: Multithreaded memory usage
by BrowserUk
in thread Multithreaded memory usage
by bingohighway
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |