[Templates] memory leak in repeated re-evaluation
Richard Clamp
richardc@unixbeard.net
Wed, 23 Apr 2003 20:31:09 +0100
% cat t
#!/usr/local/bin/perl -w
use Template;
use GTop ();
my $gtop = new GTop;
my $tt = Template->new();
my $count = 0;
while (1) {
$tt->process('a', {}, '/dev/null') or die;
if (++$count % 500 == 0) {
my $pm = $gtop->proc_mem($$);
warn "$count\t".$pm->size."\n" ;
}
}
% cat a
foo
Running it gets me:
% perl t
500 7016448
1000 9113600
1500 11345920
2000 13574144
2500 15806464
3000 18038784
3500 20271104
4000 22503424
4500 24735744
5000 26968064
5500 29200384
6000 31432704
6500 33665024
7000 35897344
7500 38129664
8000 40361984
It increases a pantload faster if the template is complex. Is there
anything simple I can do to improve this? Currently I'm okay knocking
out ~200 real files in a batch, but once it gets to over 500 the
machine decides it can't get enough ram.
--
Richard Clamp <richardc@unixbeard.net>