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: Beginner: Re: [ajmcello] Serious memory leak using LWP: Edit Log



wickedxter
User

Mar 8, 2012, 12:10 PM


Views: 860
Re: [ajmcello] Serious memory leak using LWP

This will result in memory consumption because your useing and infinite loop which is constantly sending request to the server and getting data back and holding everything in memory you can either do a cron job or schdule the script to run and close.

This works better, use system call so the other program doing the data retrieve is forked and returned to parent.

test2.pl

Code
 
while (1){

system ('c:/server/cgi-bin/test1.pl');
sleep(10);
}



file test1.pl

Code
use HTML::Parser;  
use LWP::Simple;

my $p = HTML::Parser->new();
my ($url, $content);

$url = "http://www.cnn.com";
$content = get $url;

print $p->parse($content);



(This post was edited by wickedxter on Mar 8, 2012, 12:11 PM)


Edit Log:
Post edited by wickedxter (User) on Mar 8, 2012, 12:11 PM


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

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