
wickedxter
User
Mar 8, 2012, 12:10 PM
Views: 643
|
|
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
while (1){ system ('c:/server/cgi-bin/test1.pl'); sleep(10); } file test1.pl
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)
|