]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: discard Eml->{bdy} when done using
authorEric Wong <e@80x24.org>
Sat, 9 Oct 2021 12:03:34 +0000 (12:03 +0000)
committerEric Wong <e@80x24.org>
Sat, 9 Oct 2021 21:31:06 +0000 (21:31 +0000)
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.

lib/PublicInbox/View.pm

index 64e73234f9ee2b17ca4efc4d5094d402426ee6d8..a6944b80bbed08ca41c702c234b1010571b1e5ac 100644 (file)
@@ -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