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

Re: Bug report: git -L requires excessive memory.

From
Taylor Blau <me@ttaylorr.com>
Date
Oct 31, 2022, 21:56 UTC
Message-ID
<Y2BElOFGJ8JinYxC@nand.local>
In-Reply-To
<20221031214554.GA1714@szeder.dev>
On Mon, Oct 31, 2022 at 10:45:54PM +0100, SZEDER Gábor wrote:
> 'line-log.c' contains two "NEEDSWORK leaking like a sieve" comments,
> but you managed to stumble upon yet another case (those two are in the
> code path handling merge commits, but your history is linear).
;-).
Show 19 quoted lines
> The patch below plugs this leak.
>
>   ---  >8  ---
>
> diff --git a/line-log.c b/line-log.c
> index 51d93310a4..b6ea82ac6b 100644
> --- a/line-log.c
> +++ b/line-log.c
> @@ -1195,6 +1195,9 @@ static int process_ranges_ordinary_commit(struct rev_info *rev, struct commit *c
>  	if (parent)
>  		add_line_range(rev, parent, parent_range);
>  	free_line_log_data(parent_range);
> +	for (int i = 0; i < queue.nr; i++)
> +		diff_free_filepair(queue.queue[i]);
> +	free(queue.queue);
>  	return changed;
>  }
>
>   ---  8<  ---

Very nice. I wouldn't be surprised if there are other leaks, in the line-log code, but fixing one is good regardless. If you resend with your S-o-b, I'd be happy to queue it.

Thanks, Taylor

Previous: SZEDER GáborNext: SZEDER Gábor
Message 3 of 17 in “Bug report: git -L requires excessive memory.”
  1. man dogOct 29, 2022
  2. SZEDER GáborOct 31, 2022
  3. Taylor BlauOct 31, 2022
  4. 0/3 line-log: plug some memory leaksSZEDER Gábor, Nov 2, 2022
  5. 1/3 line-log: free diff queue when processing non-merge commitsSZEDER Gábor, Nov 2, 2022
  6. Taylor BlauNov 3, 2022
  7. SZEDER GáborNov 7, 2022
  8. Ævar Arnfjörð BjarmasonNov 7, 2022
  9. SZEDER GáborNov 7, 2022
  10. Taylor BlauNov 8, 2022
  11. 2/3 line-log: free the diff queues' arrays when processing merge commitsSZEDER Gábor, Nov 2, 2022
  12. Taylor BlauNov 3, 2022
  13. 3/3 diff.c: use diff_free_queue()SZEDER Gábor, Nov 2, 2022
  14. Taylor BlauNov 3, 2022
  15. SZEDER GáborNov 7, 2022
  16. Taylor BlauNov 8, 2022
  17. Ævar Arnfjörð BjarmasonNov 3, 2022

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.