From: Patrick Steinhardt <ps@pks.im>
To: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Cc: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
git@vger.kernel.org
Subject: Re: history: 'reword HEAD' surfaces a memory leak
Date: Mon, 7 Sep 2026 14:12:48 +0200 [thread overview]
Message-ID: <ap6qQPL7dPjZy1lO@pks.im> (raw)
In-Reply-To: <c12fe123-bf10-46f1-b369-b582a623ce19@gmail.com>
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
next prev parent reply other threads:[~2026-09-07 12:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 15:26 history: 'reword HEAD' surfaces a memory leak Kristoffer Haugsbakk
2026-09-07 11:13 ` Patrick Steinhardt
2026-09-07 11:46 ` Kaartic Sivaraam
2026-09-07 12:12 ` Patrick Steinhardt [this message]
2026-09-10 15:27 ` Kristoffer Haugsbakk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ap6qQPL7dPjZy1lO@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=kaartic.sivaraam@gmail.com \
--cc=kristofferhaugsbakk@fastmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox