in reply to How to put a fat program on a (memory) weight-loss diet? [SOLVED]
Urk!
If Devel::Cycle prints a report of 89 memory-cycles at the end of my program, am I correct to surmise that “I might be on to something (big and really significant...) here?”
A typical cycle looks like this, and all of the cycles found, look like this:
Cycle (72): $Mojo::Server::CGI::A->{'app'} => \%SPE::B $SPE::B->{'renderer'} => \%Mojolicious::Renderer::C $Mojolicious::Renderer::C->{'handler'} => \%D $D->{'tt'} => \&E $E variable $self => \$F $$F => \%MojoX::Renderer::TT::G $MojoX::Renderer::TT::G->{'tt'} => \%Template::H $Template::H->{'SERVICE'} => \%Template::Service::I $Template::Service::I->{'CONTEXT'} => \%Template::Context::J $Template::Context::J->{'LOAD_TEMPLATES'} => \@K $K->[0] => \%Template::Provider::L $Template::Provider::L->{'LOOKUP'} => \%V $V->{'/var/www/spedemo-dev/public/cgi-bin/../../templates/pre_ +process.tt'} => \@T $T->[0] => \@S $S->[4] => \@T
The more I look at this, the more I think it's a red-herring... All but one of the cycles appear to be identical at least as far as the line which reads LOAD_TEMPLATES. I think I'm just looking at a curiosity of the template-engine's implementation ... i.e. a circular queue.
I surmise, upon reading Template/Provider.pm, that this most-definitely is a non-issue. The DESTROY method in this module makes explicit reference to the circular structure, and its effect upon Perl's memory-management ... and it contains the necessary code to clean all of that up in its DESTROY method, which quite-obviously has not run yet.
Okay... red herring confirmed. Mea culpa. There are no memory-cycles other than these, which is, in and of itself, a good-mark for my program. I conclude that I have eliminated this potential issue, in spite of the “89 cycles.” My program doesn't appear to contain any bona fide leaks of this nature.