git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Junio C HamanoNext: Haritha via GitGitGadget
Message 5 of 15 in “Fix to avoid high memory footprint”
  1. Fix to avoid high memory footprintHaritha via GitGitGadget, Jul 16, 2024
  2. Jeff KingJul 17, 2024
  3. Fix to avoid high memory footprintHaritha via GitGitGadget, Jul 24, 2024
  4. Junio C HamanoJul 24, 2024
  5. Jeff KingJul 24, 2024
  6. Fix to avoid high memory footprintHaritha via GitGitGadget, Jul 26, 2024
  7. Torsten BögershausenJul 26, 2024
  8. convert: avoid high memory footprintHaritha via GitGitGadget, Jul 26, 2024
  9. convert: return early when not tracingHaritha via GitGitGadget, Jul 30, 2024
  10. Junio C HamanoJul 31, 2024
  11. Haritha DJul 31, 2024
  12. convert: return early when not tracingHaritha via GitGitGadget, Jul 31, 2024
  13. Junio C HamanoJul 26, 2024
  14. Junio C HamanoJul 26, 2024
  15. Haritha DJul 30, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.