mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <>
To: Junio C Hamano <>,
	Andrzej Hunt via GitGitGadget <>,
	Derrick Stolee <>,
	Abhishek Kumar <>,
	Taylor Blau <>
Cc:, Andrzej Hunt <>,
	Andrzej Hunt <>
Subject: Re: [PATCH] commit-graph: avoid leaking topo_levels slab in write_commit_graph()
Date: Mon, 22 Feb 2021 09:15:15 -0500	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <xmqqa6rz9zrx.fsf@gitster.g>

On 2/19/2021 10:36 PM, Junio C Hamano wrote:
> "Andrzej Hunt via GitGitGadget" <> writes:
>> From: Andrzej Hunt <>
>> write_commit_graph initialises topo_levels using init_topo_level_slab(),
>> next it calls compute_topological_levels() which can cause the slab to
>> grow, we therefore need to clear the slab again using
>> clear_topo_level_slab() when we're done.
>> First introduced in 72a2bfcaf01860ce8dd6921490d903dc0ad59c89 - which
>> is currently only in master and not on maint.
> Thanks.  
> Forwarding to those who were involved in the said commit for
> insights.

>> index ed31843fa522..9529ec552139 100644
>> --- a/commit-graph.c
>> +++ b/commit-graph.c
>> @@ -2471,6 +2471,7 @@ int write_commit_graph(struct object_directory *odb,
>>  	free(ctx->graph_name);
>>  	free(ctx->commits.list);
>>  	oid_array_clear(&ctx->oids);
>> +	clear_topo_level_slab(&topo_levels);

This change looks like a sane change to me. It definitely fixes a leak.
The leak "wasn't hurting anybody" because write_commit_graph() is only
called at most once per process, and the process closes itself out
shortly after. Still, it's good to have good memory hygiene here.


  reply	other threads:[~2021-02-22 14:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19 20:13 [PATCH] commit-graph: avoid leaking topo_levels slab in write_commit_graph() Andrzej Hunt via GitGitGadget
2021-02-20  3:36 ` Junio C Hamano
2021-02-22 14:15   ` Derrick Stolee [this message]
2021-02-22 19:14     ` Andrzej Hunt
2021-02-25  6:26 Abhishek Kumar

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:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \

* 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.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).