Re: Memory leak with LWP::UserAgent on linux
Gisle Aas (gisle@aas.no)
25 Mar 1999 22:26:14 +0100
tony@default.stanford.edu writes:
> A while back I posted the following code snippet that was leaking on my
> machine to comp.lang.perl.modules and go nothing back. I reposted it tonight
> and finally got onto this mailing list so I'm asking here more directly.
> Please help if you can.
> >>>>>>>>>>>
> #!/usr/bin/perl -w
> use strict;
> use HTTP::Response;
> use LWP::UserAgent;
>
> my $ua = new LWP::UserAgent;
> my $path = "my.favorite.site";
> my $request = new HTTP::Request('GET', $path);
> my $response;
>
> for (my $i=0; $i < 450; $i++) {
> $response = $ua->request($request);
> sleep(15);
> }
> >>>>>>>>>>
> I got one response which said this didn't leak on another person's system.
> I checked another system I have access to and it doesn't leak there either.
> Here's some system details:
> Leaks Doesn't Leak
> Linux FreeBSD
> Kernel 2.0.34 on an i586 FreeBSD 2.2.8-STABLE
> 5.005_04 built for i586-linux 5.004_04 built for i386-freebsd
> libwww-perl 5.41 libwww-perl 5.20
>
> I'm hoping someone can help me fix this leak. It grows pretty fast, it
> seems as though it's not freeing up memory equal to the size of the HTML
> returned by the server. perl5.005_02 also leaks on the linux machine. I
> saw mentions of leaks in the archives but never any responses with fixes.
Perhaps the difference is that Linux perl by default is built with the
system malloc(). Have you tried a perl compiled with -Dusemymalloc=y?
--
Gisle Aas