From: Patrick Steinhardt Date: Mon, 07 Sep 2026 12:12:48 GMT Subject: Re: history: 'reword HEAD' surfaces a memory leak Message-ID: In-Reply-To: On Mon, Sep 07, 2026 at 05:16:44PM +0530, Kaartic Sivaraam wrote: > On 9/7/26 16:43, Patrick Steinhardt wrote: > > > > 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/ Awesome, thanks! Patrick