Re: [PATCH v2] Fix to avoid high memory footprint
- From
Jeff King <peff@peff.net>
- Date
- Jul 24, 2024, 22:16 UTC
- Message-ID
- <20240724221638.GA568325@coredump.intra.peff.net>
- In-Reply-To
- <pull.1744.v2.git.git.1721821503173.gitgitgadget@gmail.com>
On Wed, Jul 24, 2024 at 11:45:03AM +0000, Haritha via GitGitGadget wrote:
Show 14 quoted lines
> diff --git a/convert.c b/convert.c
> index d8737fe0f2d..c4ddc4de81b 100644
> --- a/convert.c
> +++ b/convert.c
> @@ -324,6 +324,9 @@ static void trace_encoding(const char *context, const char *path,
> struct strbuf trace = STRBUF_INIT;
> int i;
>
> + if (!trace_want(&coe))
> + return;
> +
> strbuf_addf(&trace, "%s (%s, considered %s):\n", context, path, encoding);
> for (i = 0; i < len && buf; ++i) {
> strbuf_addf(The patch itself looks good. I confirmed that running:
git init dd if=/dev/zero of=foo.bin bs=1M count=50 echo '*.bin working-tree-encoding=UTF-16LE' >.gitattributes valgrind --tool=massif git add .
goes from a max heap of 1.7G down to 51MB with your patch (whereas I think with the previous iteration it would not have, since the old check did the wrong thing on the first call to trace_encoding()).
-Peff