I forgot to point out that I invoked the code through the OS command line
and not a web server when running the memory test

> -----Original Message-----
> From: Dan Horne [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, 11 March 2006 12:34
> To: [EMAIL PROTECTED]; 
> cgiapp@lists.erlbaum.net
> Subject: [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/cgiapp@lists.erlbaum.net/
>               http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to