about summary refs log tree commit homepage
path: root/lib/PublicInbox/Feed.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-05-01 01:56:34 +0000
committerEric Wong <e@80x24.org>2014-05-01 01:56:34 +0000
commit65a86d7fbf0f07dbbca2d4c5d9d117c28ed38cc7 (patch)
tree6d94b3492794a641cd4cf0f1ef06a9af719dd3f6 /lib/PublicInbox/Feed.pm
parenta6134a0ca3ac69f2dfe353019c35eb36db3d831e (diff)
downloadpublic-inbox-65a86d7fbf0f07dbbca2d4c5d9d117c28ed38cc7.tar.gz
This prevents memory bloat in case we're serving many requests
with a large, diverse set of email addresses (potentially from
malicious spammers).
Diffstat (limited to 'lib/PublicInbox/Feed.pm')
-rw-r--r--lib/PublicInbox/Feed.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index d535cea9..6b317ab0 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -43,6 +43,8 @@ sub generate {
                 my ($add) = @_;
                 add_to_feed($feed_opts, $feed, $add, $git);
         });
+        $git = undef; # destroy pipes
+        Email::Address->purge_cache;
         $feed->as_string;
 }
 
@@ -68,6 +70,7 @@ sub generate_html_index {
                 push @messages, $mime;
                 1;
         });
+        $git = undef; # destroy pipes.
 
         my $th = Mail::Thread->new(@messages);
         $th->thread;
@@ -85,6 +88,8 @@ sub generate_html_index {
         });
         dump_html_line($_, 0, \$html) for $th->rootset;
 
+        Email::Address->purge_cache;
+
         my $footer = nav_footer($args->{cgi}, $last);
         $footer = "<hr /><pre>$footer</pre>" if $footer;
         $html . "</pre>$footer</html>";