summaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2006-07-02 01:10:14 +0200
committermkanat%bugzilla.org <>2006-07-02 01:10:14 +0200
commit0fd94fa00dc3429814a97c106f2ff0a0550e6ac0 (patch)
tree0fc2c686012aa783f1eca64e956337d4655d6a62 /Bugzilla.pm
parenta0196b5d1ed38b7bf7f0783c1c865d6642f2e2b2 (diff)
downloadbugzilla-0fd94fa00dc3429814a97c106f2ff0a0550e6ac0.tar.gz
bugzilla-0fd94fa00dc3429814a97c106f2ff0a0550e6ac0.tar.xz
Bug 343166: $template->process leaks 512K of RAM per call under mod_perl
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=justdave, a=justdave
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index 91e6b00d3..0d6e6af7d 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -300,7 +300,21 @@ sub custom_field_names {
sub request_cache {
if ($ENV{MOD_PERL}) {
require Apache2::RequestUtil;
- return Apache2::RequestUtil->request->pnotes();
+ my $request = Apache2::RequestUtil->request;
+ my $cache = $request->pnotes();
+ # Sometimes mod_perl doesn't properly call DESTROY on all
+ # the objects in pnotes(), so we register a cleanup handler
+ # to make sure that this happens.
+ if (!$cache->{cleanup_registered}) {
+ $request->push_handlers(PerlCleanupHandler => sub {
+ my $r = shift;
+ foreach my $key (keys %{$r->pnotes}) {
+ delete $r->pnotes->{$key};
+ }
+ });
+ $cache->{cleanup_registered} = 1;
+ }
+ return $cache;
}
return $_request_cache;
}