Re[2]: memory problem with threads

[email protected]
Newsgroups perl.ithreads
Message-ID <[email protected]>
Hello Robert,

Thursday, February 19, 2004, 7:01:34 AM, you wrote:


RF> Hi,

>> this script consume fast whole memory

RF> Get more memory :)

RF> You have to either call detach() or join(),
RF> otherwise the resources used wont be released.

RF> If you want to get the return value you call join:

	my @result = $thr->join();

RF> if it should just be cleaned up upon termination call detach:

	$thr->detach();



RF> mvh,
RF> 
RF> ------------------------------------------------------------------------
RF> !  Robert Friberg          0733-839080
RF> !  Developer/Trainer      
RF> perl,java,dotnet,linux,xml,uml,sql,c/c++,vb
RF> !  Ensofus AB		   http://www.ensofus.se/
RF> !  Miljo Online AB         http://www.miljo-online.se/
RF> 
RF> ------------------------------------------------------------------------

Thanks for your reply.

I have tried it, no success.
I have simplified this code to:
--------------------------------------------
#!perl -w
use threads;

while(1){
    $thr = threads->new(\&lwp);
    $thr->join();  # or $thr->detach; no difference :-(
    sleep 10;
};

sub lwp {
    return 1;
};
---------------------------------------------
and I still have the same problem. The Windows Task Manager shows me
that I have only one Thread but constantly increasing number of
Handles.

How can I debug this?

>> 
>> 
>> 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]
>> 
>> 



-- 
Best regards,
Pavel                           mailto:[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.