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

Re: history: 'reword HEAD' surfaces a memory leak

From
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Date
Sep 7, 2026, 11:46 UTC
Message-ID
<c12fe123-bf10-46f1-b369-b582a623ce19@gmail.com>
In-Reply-To
<ap6cU2elXvmlLgb8@pks.im>
On 9/7/26 16:43, Patrick Steinhardt wrote:
Show 22 quoted lines
> 
> This feels familiar, even though it doesn't reproduce on my machine. Do
> you have "i18n.commitencoding" set? In any case, I think the following
> patch should fix it:
> 
> diff --git a/builtin/history.c b/builtin/history.c
> index 000155ad9c..bca95b9d05 100644
> --- a/builtin/history.c
> +++ b/builtin/history.c
> @@ -158,6 +158,7 @@ static int commit_tree_ext(struct repository *repo,
>   	*out = lookup_commit_or_die(&rewritten_commit_oid, "rewritten commit");
>   
>   out:
> +	repo_unuse_commit_buffer(repo, commit_with_message, original_message);
>   	free_commit_extra_headers(original_extra_headers);
>   	strbuf_release(&commit_message);
>   	free(original_author);
> 
> I know that we've already been discussing this memory leak on the
> mailing list at one point in time, and we've already had a patch similar
> to the above. So why wasn't this merged...?
>

My bad, I suppose. There was a suggestion by Peff that the commit message was misleading. Per [2], the leak only happens when we get a commit that isn't cached in the commit slab. I was trying to identify the specific case in which we get a commit that's not cached in the slab but eventually got busy with other work. I will get around to it soon and send a long pending re-roll.

[[ References ]]

[2]: https://lore.kernel.org/git/94b0bed5-c86a-4291-b958-52f09faebd29@gmail.com/

-- Sivaraam

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 3 of 5 in “history: 'reword HEAD' surfaces a memory leak”
  1. Kristoffer HaugsbakkSep 3, 2026
  2. Patrick SteinhardtSep 7, 2026
  3. Kaartic SivaraamSep 7, 2026
  4. Patrick SteinhardtSep 7, 2026
  5. Kristoffer HaugsbakkSep 10, 2026

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.