]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git: avoid Perl5 internal scratchpad target cache
authorEric Wong <e@80x24.org>
Sun, 24 Oct 2021 00:20:45 +0000 (18:20 -0600)
committerEric Wong <e@80x24.org>
Sun, 24 Oct 2021 02:20:33 +0000 (02:20 +0000)
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

index 374a3b4dd71d9849aea7a1c7dee2e8d2e2d8d1f6..4078dd5b7cfe79f8bf1c0d29cfbe4b3cba35aae5 100644 (file)
@@ -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 ($$) {