diff options
author | Eric Wong <e@yhbt.net> | 2020-01-11 06:28:16 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-01-12 21:26:42 +0000 |
commit | 195c40c82e77c73e171f75529b80c7561565d512 (patch) | |
tree | 738c85840311d34629ae46bbc3ceb4cd9e5d8095 /lib/PublicInbox/WwwAttach.pm | |
parent | 80e819ceebf922ecda684cc8ef0848ddc709a73c (diff) | |
download | public-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/WwwAttach.pm')
-rw-r--r-- | lib/PublicInbox/WwwAttach.pm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/WwwAttach.pm b/lib/PublicInbox/WwwAttach.pm index cda1c6c8..92f47e49 100644 --- a/lib/PublicInbox/WwwAttach.pm +++ b/lib/PublicInbox/WwwAttach.pm @@ -40,7 +40,7 @@ sub get_attach ($$$) { my $mime = $ctx->{-inbox}->msg_by_mid($ctx->{mid}) or return $res; $mime = PublicInbox::MIME->new($mime); $res->[3] = $idx; - msg_iter($mime, \&get_attach_i, $res); + msg_iter($mime, \&get_attach_i, $res, 1); pop @$res; # cleanup before letting PSGI server see it $res } |