Hi,
> this script consume fast whole memory
Get more memory :)
You have to either call detach() or join(),
otherwise the resources used wont be released.
If you want to get the return value you call join:
my @result = $thr->join();
if it should just be cleaned up upon termination call detach:
$thr->detach();
mvh,
------------------------------------------------------------------------
! Robert Friberg 0733-839080
! Developer/Trainer perl,java,dotnet,linux,xml,uml,sql,c/c++,vb
! Ensofus AB http://www.ensofus.se/
! Miljo Online AB http://www.miljo-online.se/
------------------------------------------------------------------------
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 19, 2004 5:36 AM
> To: [EMAIL PROTECTED]
> Subject: memory problem with threads
>
>
> Hello perl-ithreads,
>
> this script consume fast whole memory
> undef dont help me - memory usage increased on every &lwp loop
>
> I run it on WindowsXP SP1 with ActiveState 5.8.2
>
> please help.
>
> Thanks in advance.
>
>
>
> #!perl -w
> use threads;
> #use strict; # of course I have ran it with "use strict" too
> use Win32::Internet; #
> #use LWP; # the same problem, no difference
>
> while(1){
> $thr = threads->new(\&lwp);
> # lwp(); # works fine
> #$thr->join;
> sleep 10;
> };
>
> sub lwp {
> $INET = new Win32::Internet();
> $file = $INET->FetchURL("http://www.yahoo.com");
> #undef $INET;
> #undef $file;
> return 1;
>
> #my $url = 'http://web.de';
> #my $agent = LWP::UserAgent->new;
> #$agent->agent("Mozilla/4.0");
> #my $request = HTTP::Request->new( GET => $url );
> #my $response = $agent->request($request);
> #$response->is_success or print "lwp-Fehler:
> ".$response->message ." \n";
> #my $contents = $response->content;
> # #return $contents;
> #1;
> };
>
> --
> Best regards,
> Pavel mailto:[EMAIL PROTECTED]
>
>