From: Jeff King <peff@peff.net>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/4] test-bloom: stop setting up Git directory twice
Date: Mon, 6 Nov 2023 12:20:24 -0500 [thread overview]
Message-ID: <20231106172024.GA10414@coredump.intra.peff.net> (raw)
In-Reply-To: <fb1cc73ed3395ba3de72aba70d7679dd85ebb034.1699267422.git.ps@pks.im>
On Mon, Nov 06, 2023 at 11:45:53AM +0100, Patrick Steinhardt wrote:
> We're setting up the Git directory twice in the `test-tool bloom`
> helper, once at the beginning of `cmd_bloom()` and once in the local
> subcommand implementation `get_bloom_filter_for_commit()`. This can lead
> to memory leaks as we'll overwrite variables of `the_repository` with
> newly allocated data structures. On top of that it's simply unnecessary.
>
> Fix this by only setting up the Git directory once.
Makes sense. This situation was created by 094a685cd7 (t: make
test-bloom initialize repository, 2020-07-29), which added the setup
call at the start of the program.
That commit closed the door to running test-bloom outside of a
repository for sub-commands that could handle it (perhaps the murmur3
one, but I didn't test). So there are two possible directions here:
- drop the call in cmd__bloom() and make sure all of the relevant
sub-command functions do the setup.
- drop the one command-specific one (i.e., your patch)
In practice I don't think anybody cares about running this test-helper
outside of a repository, and having to do setup in each sub-command is
an extra maintenance burden. So I think your patch is the best
direction.
-Peff
next prev parent reply other threads:[~2023-11-06 17:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-06 10:45 [PATCH 0/4] Memory leak fixes Patrick Steinhardt
2023-11-06 10:45 ` [PATCH 1/4] test-bloom: stop setting up Git directory twice Patrick Steinhardt
2023-11-06 17:20 ` Jeff King [this message]
2023-11-06 10:45 ` [PATCH 2/4] shallow: fix memory leak when registering shallow roots Patrick Steinhardt
2023-11-06 17:21 ` Jeff King
2023-11-06 10:46 ` [PATCH 3/4] setup: refactor `upgrade_repository_format()` to have common exit Patrick Steinhardt
2023-11-06 10:46 ` [PATCH 4/4] setup: fix leaking repository format Patrick Steinhardt
2023-11-06 17:32 ` [PATCH 0/4] Memory leak fixes Jeff King
2023-11-07 2:20 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231106172024.GA10414@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).