user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/4] solver_git: shorten scalar lifetimes
  2021-10-09 12:03  6% [PATCH 0/4] WWW-related memory savings Eric Wong
@ 2021-10-09 12:03  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-10-09 12:03 UTC (permalink / raw)
  To: meta

Some of these scalar buffers may be large patches, so try
to keep them as short-lived as possible to reduce memory
pressure.
---
 lib/PublicInbox/SolverGit.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
index b0cd0f2c..5d5060f4 100644
--- a/lib/PublicInbox/SolverGit.pm
+++ b/lib/PublicInbox/SolverGit.pm
@@ -111,8 +111,6 @@ sub extract_diff ($$) {
 	my ($self, $want, $smsg) = @$arg;
 	my ($part) = @$p; # ignore $depth and @idx;
 	my $ct = $part->content_type || 'text/plain';
-	my ($s, undef) = msg_part_text($part, $ct);
-	defined $s or return;
 	my $post = $want->{oid_b};
 	my $pre = $want->{oid_a};
 	if (!defined($pre) || $pre !~ /\A[a-f0-9]+\z/) {
@@ -122,11 +120,12 @@ sub extract_diff ($$) {
 	# Email::MIME::Encodings forces QP to be CRLF upon decoding,
 	# change it back to LF:
 	my $cte = $part->header('Content-Transfer-Encoding') || '';
+	my ($s, undef) = msg_part_text($part, $ct);
+	defined $s or return;
+	delete $part->{bdy};
 	if ($cte =~ /\bquoted-printable\b/i && $part->crlf eq "\n") {
 		$s =~ s/\r\n/\n/sg;
 	}
-
-
 	$s =~ m!( # $1 start header lines we save for debugging:
 
 		# everything before ^index is optional, but we don't
@@ -169,6 +168,7 @@ sub extract_diff ($$) {
 		# because git-apply(1) handles that case, too
 		(?:^(?:[\@\+\x20\-\\][^\n]*|)$LF)+
 	)!smx or return;
+	undef $s; # free memory
 
 	my $di = {
 		hdr_lines => $1,

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/4] WWW-related memory savings
@ 2021-10-09 12:03  6% Eric Wong
  2021-10-09 12:03  7% ` [PATCH 1/4] solver_git: shorten scalar lifetimes Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-10-09 12:03 UTC (permalink / raw)
  To: meta

Some things I noticed while tracking down our own
reference cycle leak and the Encode <= 3.12 memory leak.
There's more aggressive stuff I'm testing, too, but
I've yet to check throughput performance.

Eric Wong (4):
  solver_git: shorten scalar lifetimes
  view: discard Eml->{bdy} when done using
  http: avoid Perl target cache for psgi.input
  view: save memory by dropping smsg->{from_name} on use

 lib/PublicInbox/HTTP.pm       | 30 ++++++------------------------
 lib/PublicInbox/SearchView.pm |  2 +-
 lib/PublicInbox/Smsg.pm       |  9 +++------
 lib/PublicInbox/SolverGit.pm  |  8 ++++----
 lib/PublicInbox/View.pm       |  4 +++-
 5 files changed, 17 insertions(+), 36 deletions(-)

^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-10-09 12:03  6% [PATCH 0/4] WWW-related memory savings Eric Wong
2021-10-09 12:03  7% ` [PATCH 1/4] solver_git: shorten scalar lifetimes Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).