From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD0B9483BD5 for ; Mon, 7 Sep 2026 12:12:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788783176; cv=none; b=ZvB7Zd8wYQPqdzMtvxtkTuzcx9aOAS31Rum0LBCp3/AkrU9ZeFjSMHTCobSjFrnwkTonoLPqZ68jADQIC5tvwechFA42cJ8olXa0MpzRASMXj/fxAmYX9tUBJTrB/S0iGuBV7cXzLJWd6sbdYmsoLRxGyYdGJbAOYsQrmwidn3I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788783176; c=relaxed/simple; bh=qJ+G1ydkZcAS1NmOcEWRoNAIs8zWj0zTKnY9PGR5f+k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=d25q8Ha0BMZeUuJE54UgLCGAlO0LX6urAdMoVroCWTAqjUMDW9XMDquUYW9Qwolt88Z8WOf172Ch8IRxfWq9ZaS9SUSIh2QdPOIVxZM05aVKWVxa2+Sro99SpLnf05Mbb8HMVVhsippIY2iD+B+NNHLqp/8ddBnVS9fFfOBdN+g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=lZQmQ9OA; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=aNYs7ROu; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="lZQmQ9OA"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="aNYs7ROu" Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id EB5781D000D2; Mon, 7 Sep 2026 08:12:53 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Mon, 07 Sep 2026 08:12:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1788783173; x=1788869573; bh=WJgBI1VqrI wPYpkohtmFlHuhL9S9aXLlSVndm4o5Ins=; b=lZQmQ9OApG2WJmz4p2qUusTluV o+1h4FpqebTOjEzALPudgDMHQVmxGUZ3tMUXS4WYc9AApitmoq0i8/SrCUNzgLK0 rr82jJ8EbDXvhT5OTT/+XjRuqXMudaxxaZSLgnpO0dLZFJ537yfKep1a9/ms9lGb 1sMKKLiZfo0Nop6zHClYq3XsQIjqxCIW6QEcGGChZkIHpI1p4EHlsxm6e2ISb19V HOoR590K7P6S9P2cLPx9RswP91JYS/YqkZd0nUTpq5ChkzJBRNZydcEJZTcRYHF+ Lv1ADjHXZwRm9YoIFkLIlUhHSfp64z38x11kKMGymd8ZNQqZQ0ClHkYAtAZw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1788783173; x=1788869573; bh=WJgBI1VqrIw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L9NBrpuUZkZ7MPbLdCsJyDPLPIlzY+vJC/R3ig X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Sep 2026 08:12:52 -0400 (EDT) Received: by mail (OpenSMTPD) with ESMTPSA id f49080e1 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 7 Sep 2026 12:12:51 +0000 (UTC) Date: Mon, 7 Sep 2026 14:12:48 +0200 From: Patrick Steinhardt To: Kaartic Sivaraam Cc: Kristoffer Haugsbakk , git@vger.kernel.org Subject: Re: history: 'reword HEAD' surfaces a memory leak Message-ID: References: <04faa984-5b56-406b-baa9-dbb4b5eab259@app.fastmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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