All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "John Cai via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, John Cai <johncai86@gmail.com>
Subject: Re: [PATCH] promisor-remote.c: use oidset for deduplication
Date: Thu, 13 Jan 2022 15:45:00 -0800	[thread overview]
Message-ID: <xmqqilunfber.fsf@gitster.g> (raw)
In-Reply-To: <pull.1187.git.git.1642105926064.gitgitgadget@gmail.com> (John Cai via GitGitGadget's message of "Thu, 13 Jan 2022 20:32:05 +0000")

"John Cai via GitGitGadget" <gitgitgadget@gmail.com> writes:

> diff --git a/object-file.c b/object-file.c
> index 8be57f48de7..baec8f099de 100644
> --- a/object-file.c
> +++ b/object-file.c
> @@ -1519,6 +1519,7 @@ static int do_oid_object_info_extended(struct repository *r,
>  	struct cached_object *co;
>  	struct pack_entry e;
>  	int rtype;
> +	struct oidset to_fetch = OIDSET_INIT;
>  	const struct object_id *real = oid;
>  	int already_retried = 0;
>  
> @@ -1587,7 +1588,8 @@ static int do_oid_object_info_extended(struct repository *r,
>  			 * TODO Investigate checking promisor_remote_get_direct()
>  			 * TODO return value and stopping on error here.
>  			 */
> -			promisor_remote_get_direct(r, real, 1);
> +			oidset_insert(&to_fetch, real);
> +			promisor_remote_get_direct(r, &to_fetch);
>  			already_retried = 1;
>  			continue;
>  		}

Everything that migrated from oid_array to oidset should be OK
because it is likely that existing oid_array_clear() would not
compile until it is replaced with oidset_clear(), at which point
the oidset will be cleared when we are done with it.

However, this one did not use an oid_array and did not have to clear
to release the resources.  So it is very likely that nobody clears
to_fetch that is introduced by this patch, no?

I suspect that this introduces a new leak.

  reply	other threads:[~2022-01-13 23:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 20:32 [PATCH] promisor-remote.c: use oidset for deduplication John Cai via GitGitGadget
2022-01-13 23:45 ` Junio C Hamano [this message]
2022-01-14 12:11 ` Ævar Arnfjörð Bjarmason
2022-01-14 19:14   ` Junio C Hamano
2022-01-14 23:12     ` Junio C Hamano
2022-01-24 22:55   ` John Cai
2022-01-25 19:17     ` Jonathan Tan

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=xmqqilunfber.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johncai86@gmail.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 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.