From 48af2131c7ef0e7001f99fe3c2dabd1713d3e800 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 23 Oct 2021 18:20:45 -0600 Subject: git: avoid Perl5 internal scratchpad target cache Creating a scalar ref directly off substr() seemed to be causing the underlying non-ref scalar to end up in Perl's scratchpad. Assign the substr result to a local variable seems sufficient to prevent multi-megabyte SVs from lingering indefinitely when a read-only daemon serves rare, oversized blobs. --- lib/PublicInbox/Git.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/Git.pm') diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 374a3b4d..4078dd5b 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -158,7 +158,8 @@ sub my_read ($$$) { return; # unrecoverable error } } - \substr($$rbuf, 0, $len, ''); + my $no_pad = substr($$rbuf, 0, $len, ''); + \$no_pad; } sub my_readline ($$) { -- cgit v1.2.3-24-ge0c7