[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] HTMLTemplate::Expr consumes huge amounts of memory


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?


Dan Horne


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.