about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-09 12:03:34 +0000
committerEric Wong <e@80x24.org>2021-10-09 21:31:06 +0000
commitf37219b70b5ab83cd7740c4d533f1cf7e5049946 (patch)
tree5ad042967cf7143378c3ac1d7ba28218d93c98cc /lib/PublicInbox/View.pm
parent17c6b04327bac7debf5dbfa633a8fbdf3cd96873 (diff)
downloadpublic-inbox-f37219b70b5ab83cd7740c4d533f1cf7e5049946.tar.gz
view: discard Eml->{bdy} when done using
We can release the raw body buffer once we've obtained a copy of
the decoded buffer.  This reduces memory pressure ahead of some
expensive diff processing.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 64e73234..a6944b80 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -533,6 +533,7 @@ sub attach_link ($$$$;$) {
 
         my $nl = $idx eq '1' ? '' : "\n"; # like join("\n", ...)
         my $size = length($part->body);
+        delete $part->{bdy}; # save memory
 
         # hide attributes normally, unless we want to aid users in
         # spotting MUA problems:
@@ -632,6 +633,7 @@ sub add_text_body { # callback for each_part
                 attach_link($ctx, $ct, $p, $fn, $err);
                 $$rv .= "\n";
         }
+        delete $part->{bdy}; # save memory
         foreach my $cur (@sections) {
                 if ($cur =~ /\A>/) {
                         # we use a <span> here to allow users to specify