[htmltmpl] HTMLTemplate::Expr consumes huge amounts of memory
Brought to you by:
samtregar
From: Dan H. <dan...@re...> - 2006-03-11 01:32:47
|
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) =3D @_; my %content =3D $self->get_content($content_id); my $template =3D $self->template->load( file =3D> $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.=20 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 |