about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwAtomStream.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-01-11 06:28:16 +0000
committerEric Wong <e@yhbt.net>2020-01-12 21:26:42 +0000
commit195c40c82e77c73e171f75529b80c7561565d512 (patch)
tree738c85840311d34629ae46bbc3ceb4cd9e5d8095 /lib/PublicInbox/WwwAtomStream.pm
parent80e819ceebf922ecda684cc8ef0848ddc709a73c (diff)
downloadpublic-inbox-195c40c82e77c73e171f75529b80c7561565d512.tar.gz
We're often iterating through messages while writing to another
buffer in our WWW interface, causing memory usage to multiply.
Since we know we won't need to keep the MIME object around in
some cases, and can tell msg_iter to clobber the on-stack
variable while it operates on subparts of multipart messages.

With xt/mem-msgview.t switched to multipart from the previous
commit, this shows a 13 MB memory reduction on that test.
Diffstat (limited to 'lib/PublicInbox/WwwAtomStream.pm')
-rw-r--r--lib/PublicInbox/WwwAtomStream.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm
index 9430dd97..9ec1383d 100644
--- a/lib/PublicInbox/WwwAtomStream.pm
+++ b/lib/PublicInbox/WwwAtomStream.pm
@@ -101,9 +101,9 @@ sub atom_header {
 sub feed_entry {
         my ($self, $smsg) = @_;
         my $ctx = $self->{ctx};
-        my $mime = $smsg->{mime};
+        my $mid = $smsg->mid; # may extract Message-ID from {mime}
+        my $mime = delete $smsg->{mime};
         my $hdr = $mime->header_obj;
-        my $mid = $smsg->mid;
         my $irt = PublicInbox::View::in_reply_to($hdr);
         my $uuid = to_uuid($mid);
         my $base = $ctx->{feed_base_url};