On Jun 30, 2006, at 6:20 PM, Max Kanat-Alexander wrote:

On Fri, 2006-06-30 at 00:37 -0400, Perrin Harkins wrote:
HOWEVER: If I "delete $r->pnotes->{template}" before the script ends,
there's no memory leak.

It sounds like a problem with the DESTROY method in Template::Provider.
  Can you add some logging to that method to see if it gets called?

        Hey Perrin. You are indeed exactly correct. I tested it, and the
DESTROY method in Template::Provider never gets called. However, when I
manually do the delete on the hash key, DESTROY does get called.

        So, is there anything I can do about this in my code? Would this be a
bug in mod_perl or in the Template Toolkit?

        This is TT 2.15, FWIW.

I had the same inkling as perrin... my guess is that somewhere in the code someone did something that is not letting the object go out of scope. I think its more likely that the bug is in the way Bugzilla uses TT -- a some reference to the template object is getting stored persistently ( i think everyone has made a similar mistake ). I've never had a problem with a pnote living on after a request, and your issue is either the pnote is still around or the object the pnote references is linked elsewhere.

I think the easiest fix, for now, would be to toss in a cleanup handler that just undefs the pnote if its defined. if you're only using the pnote within a single handler stage, i'd just undef it at the end of the handler after all the output is generated. i do tons of 'just in case' cleanup things.



| - - - - - - - - - - - - - - - - - - - -
| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - -




| - - - - - - - - - - - - - - - - - - - -
| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - -




Reply via email to