HTMLTemplate::Expr consumes huge amounts of memory

"Dan Horne" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Organization Redbone
Message-ID <000001c644ab$b077b790$6503a8c0@rdbxp01>
Hi

I'm using CGI::Application::Plugin::Anytemplate with HTML::Template::Expr
for an application, and it uses a heck of a lot of memory. Because my code
is spread over a number of packages, I'll summarise my logic in pseudo-code:

sub publish_all {
    foreach my $content_id ($self->get_content_ids()) {
       $self->publish_article($content_id)
    }
}

sub publish_article {
	my ($self, $content_id) = @_;
	my %content = $self->get_content($content_id);

      my $template =  $self->template->load(
         file => $self->get_template($content{template})
      );

	$template->param(%content);
      write_to_file_system(${$template->output});

	1;
}

As I loop through "publish_article", the memory goes up the more times it is
called. No globals are defined in my modules. 

Trying to track down memory usage in Perl can be hard. Running
Devel::FindGlobals, I see that the reported size for
$HTML::Template::Expr::PARSER is 100,039,491 bytes after publishing 500
articles! Assuming that the stats are correct, how can I keep $PARSER down
to a minimal size?

BTW. For my test, I invoked the app via the OS command line not through the
web server

Dan Horne



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
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.