All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: "Samo Pogačnik" <samo_pogacnik@t-2.net>
Cc: "Samo Pogačnik via GitGitGadget" <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH 1/2] shallow: free local object_array allocations
Date: Fri, 9 Jan 2026 17:33:53 +0100	[thread overview]
Message-ID: <aWEt8UXucXMY0QCg@pks.im> (raw)
In-Reply-To: <eefa06bc46f8029b68efe993da67d14e268e1bf2.camel@t-2.net>

On Fri, Jan 09, 2026 at 05:21:45PM +0100, Samo Pogačnik wrote:
> Hi Patrick,
> thanks a lot for the reply.
> 
> On Tue, 2026-01-06 at 08:44 +0100, Patrick Steinhardt wrote:
> > On Tue, Dec 09, 2025 at 06:11:19PM +0000, Samo Pogačnik via GitGitGadget
> > wrote:
> > > From: =?UTF-8?q?Samo=20Poga=C4=8Dnik?= <samo_pogacnik@t-2.net>
> > > 
> > > The local object_array 'stack' in get_shallow_commits() function
> > > does not free its dynamic elements before the function returns.
> > > As a result elements remain allocated and their reference forgotten.
> > 
> > I think the elements themselves are actually fine. We have the following
> > loop:
> > 
> > 	while (commit || i < heads->nr || stack.nr) {
> > 
> > So while the stack still has entries, we'll keep on iteration.
> > Furthermore, there is no `break` or early return in the loop, so we can
> > sure that we actually pop every single element from the array.
> > 
> > That being said, what we _don't_ do is to free the array itself. So I'm
> > mostly splitting hairs with how the commit message is phrased, the
> > change looks correct to me.
> > 
> > What I'm wondering though is why we never hit this memory leak in our
> > test suite. I guess the reason is simply that we ain't got enough test
> > coverage around shallow clones. Have you seen this leak in the wild? And
> > if so, can we add a test case that surfaces it?
> > 
> 
> Actually, the test I've added with the patch 2/2 does not pass without this
> memory fix in linux-leaks and linux-reftable-leaks test runs.

In that case it would make sense to point out this detail in the commit
message to make it a bit easier for the reviewer. Thanks!

Patrick

  reply	other threads:[~2026-01-09 16:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 18:11 [PATCH 0/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2025-12-09 18:11 ` [PATCH 1/2] shallow: free local object_array allocations Samo Pogačnik via GitGitGadget
2026-01-06  7:44   ` Patrick Steinhardt
2026-01-09 16:21     ` Samo Pogačnik
2026-01-09 16:33       ` Patrick Steinhardt [this message]
2025-12-09 18:11 ` [PATCH 2/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2026-01-06  7:44   ` Patrick Steinhardt
2026-01-09 16:48     ` Samo Pogačnik
2026-01-09 22:23 ` [PATCH v2 0/2] " Samo Pogačnik via GitGitGadget
2026-01-09 22:23   ` [PATCH v2 1/2] shallow: free local object_array allocations Samo Pogačnik via GitGitGadget
2026-01-09 22:23   ` [PATCH v2 2/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2026-01-10  4:17     ` Junio C Hamano
2026-01-10  5:13   ` [PATCH v3 0/2] " Samo Pogačnik via GitGitGadget
2026-01-10  5:13     ` [PATCH v3 1/2] shallow: free local object_array allocations Samo Pogačnik via GitGitGadget
2026-01-10  5:13     ` [PATCH v3 2/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2026-01-15 15:50       ` Kristoffer Haugsbakk
2026-01-16 22:30     ` [PATCH v4 0/2] " Samo Pogačnik via GitGitGadget
2026-01-16 22:31       ` [PATCH v4 1/2] shallow: free local object_array allocations Samo Pogačnik via GitGitGadget
2026-01-16 22:31       ` [PATCH v4 2/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2026-02-11 13:38         ` Patrick Steinhardt
2026-02-13 20:48           ` Samo Pogačnik
2026-02-14  9:40           ` Samo Pogačnik
2026-02-15 11:19             ` Samo Pogačnik
2026-02-15 20:11       ` [PATCH v5 0/2] " Samo Pogačnik via GitGitGadget
2026-02-15 20:11         ` [PATCH v5 1/2] shallow: free local object_array allocations Samo Pogačnik via GitGitGadget
2026-02-15 20:11         ` [PATCH v5 2/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2026-02-20 22:34         ` [PATCH v5 0/2] " Junio C Hamano

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=aWEt8UXucXMY0QCg@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=samo_pogacnik@t-2.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.