From: Patrick Steinhardt Date: Wed, 01 Jul 2026 08:26:43 GMT Subject: Re: [PATCH 2/3] revision: avoid leaking bloom keyvecs with multiple traversals Message-ID: In-Reply-To: <20260701064052.GB2580331@coredump.intra.peff.net> On Wed, Jul 01, 2026 at 02:40:52AM -0400, Jeff King wrote: [snip] > There's an alternative fix, which is that prepare_to_use_bloom_filter() > could notice that we already have keyvec entries and just reuse them. > But this is less safe; the keyvec depends on the pruning pathspec, and > we don't know if that has changed. Right. We could of course start to record the pruning pathspec so that we're able to tell these cases apart, and if so we could reuse the bloom keyvec entries safely. But as you mention... > I think it would _probably_ work in practice, since any caller using a > rev_info for multiple traversals is probably doing so with the same > pathspec. But it would also create a very subtle bug if that assumption > is violated. So we'll do the safer thing here, and generate fresh keyvec > entries for each traversal. The efficiency difference is probably not > noticeable, and this is what was happening already (we just weren't > bothering to free the old ones!). ... we haven't been doing that beforehand, either, so it's fine to not care about that for now and just plug the memory leak. Patrick