]> Sergey Matveev's repositories - public-inbox.git/commit
thread: avoid Perl5 internal scratchpad target cache
authorEric Wong <e@80x24.org>
Sun, 24 Oct 2021 00:20:44 +0000 (18:20 -0600)
committerEric Wong <e@80x24.org>
Sun, 24 Oct 2021 02:20:33 +0000 (02:20 +0000)
commit08b543eb6c67cc19ea8e86afe6b9494df79e2fea
tree12178b7b3dd008b630d31175f3e6684202397e1e
parenta877fe97c753e7dc1803936e932adff566f7641d
thread: avoid Perl5 internal scratchpad target cache

The use of array-returning built-ins such as `grep' inside
arrayref declarations appears to result in permanently allocated
scratchpad space for caching according to my malloc inspector.

Thread skeletons get discarded every response, but multiple
skeletons can exist in memory at once, so do what we can to
prevent long-lived allocations from being made, here.

In other words, replacing constructs such as:

my $foo = [ grep(...) ];

with:

my @foo = grep(...);

Seems to ensure the mortality of the underlying array.
lib/PublicInbox/SearchThread.pm
lib/PublicInbox/SearchView.pm
lib/PublicInbox/View.pm
t/thread-cycle.t