Git Mailing List Archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix memory leak in get_reachable_subset
@ 2023-04-21 23:44 Mike Hommey
  2023-04-24 15:21 ` Derrick Stolee
  2023-04-24 16:09 ` Junio C Hamano
  0 siblings, 2 replies; 9+ messages in thread
From: Mike Hommey @ 2023-04-21 23:44 UTC (permalink / raw)
  To: git; +Cc: gitster, Mike Hommey

---
 commit-reach.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/commit-reach.c b/commit-reach.c
index 70bde8af05..f15d84566b 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -944,6 +944,8 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
 		}
 	}
 
+	clear_prio_queue(&queue);
+
 	clear_commit_marks_many(nr_to, to, PARENT1);
 	clear_commit_marks_many(nr_from, from, PARENT2);
 
-- 
2.39.0.1.g6739ec1790


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix memory leak in get_reachable_subset
  2023-04-21 23:44 Mike Hommey
@ 2023-04-24 15:21 ` Derrick Stolee
  2023-04-24 16:09 ` Junio C Hamano
  1 sibling, 0 replies; 9+ messages in thread
From: Derrick Stolee @ 2023-04-24 15:21 UTC (permalink / raw)
  To: Mike Hommey, git; +Cc: gitster

On 4/21/2023 7:44 PM, Mike Hommey wrote:
> @@ -944,6 +944,8 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
>  		}
>  	}
>  
> +	clear_prio_queue(&queue);
> +

Thanks. This is a leak that has existed since the method was first
created in fcb2c0769db (commit-reach: implement get_reachable_subset,
2018-11-02). I appreciate the attention to detail.

-Stolee

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix memory leak in get_reachable_subset
  2023-04-21 23:44 Mike Hommey
  2023-04-24 15:21 ` Derrick Stolee
@ 2023-04-24 16:09 ` Junio C Hamano
  2023-04-24 20:41   ` Mike Hommey
  1 sibling, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2023-04-24 16:09 UTC (permalink / raw)
  To: Mike Hommey; +Cc: git, Derrick Stolee

Mike Hommey <mh@glandium.org> writes:

> ---
>  commit-reach.c | 2 ++
>  1 file changed, 2 insertions(+)

Missing sign-off?

[jc: adding the author of fcb2c076 (commit-reach: implement
get_reachable_subset, 2018-11-02) to the CC list]

> diff --git a/commit-reach.c b/commit-reach.c
> index 70bde8af05..f15d84566b 100644
> --- a/commit-reach.c
> +++ b/commit-reach.c
> @@ -944,6 +944,8 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
>  		}
>  	}
>  
> +	clear_prio_queue(&queue);
> +
>  	clear_commit_marks_many(nr_to, to, PARENT1);
>  	clear_commit_marks_many(nr_from, from, PARENT2);

Looking good.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix memory leak in get_reachable_subset
  2023-04-24 16:09 ` Junio C Hamano
@ 2023-04-24 20:41   ` Mike Hommey
  0 siblings, 0 replies; 9+ messages in thread
From: Mike Hommey @ 2023-04-24 20:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Derrick Stolee

On Mon, Apr 24, 2023 at 09:09:33AM -0700, Junio C Hamano wrote:
> Mike Hommey <mh@glandium.org> writes:
> 
> > ---
> >  commit-reach.c | 2 ++
> >  1 file changed, 2 insertions(+)
> 
> Missing sign-off?

Gah. Sorry, I forgot it in this and another patch I sent a few days
ago ([PATCH] Handle compiler versions containing a dash)

Do you want full resends or is it okay if I just add

  Signed-off-by: Mike Hommey <mh@glandium.org>

here?

Mike

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] Fix memory leak in get_reachable_subset
@ 2023-06-03  0:28 Mike Hommey
  2023-06-03  2:02 ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Mike Hommey @ 2023-06-03  0:28 UTC (permalink / raw)
  To: git; +Cc: gitster, Mike Hommey

Signed-off-by: Mike Hommey <mh@glandium.org>
---
 commit-reach.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/commit-reach.c b/commit-reach.c
index 70bde8af05..f15d84566b 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -944,6 +944,8 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
 		}
 	}
 
+	clear_prio_queue(&queue);
+
 	clear_commit_marks_many(nr_to, to, PARENT1);
 	clear_commit_marks_many(nr_from, from, PARENT2);
 
-- 
2.41.0.6.ge371d37104


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix memory leak in get_reachable_subset
  2023-06-03  0:28 [PATCH] Fix memory leak in get_reachable_subset Mike Hommey
@ 2023-06-03  2:02 ` Junio C Hamano
  2023-06-03  6:02   ` René Scharfe
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2023-06-03  2:02 UTC (permalink / raw)
  To: Derrick Stolee; +Cc: git, Mike Hommey

Mike Hommey <mh@glandium.org> writes:

> Signed-off-by: Mike Hommey <mh@glandium.org>
> ---

As most lines in the affected function seems to come from your
fcb2c076 (commit-reach: implement get_reachable_subset, 2018-11-02),
I'll redirect the review of this patch to you.

Thanks.

>  commit-reach.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/commit-reach.c b/commit-reach.c
> index 70bde8af05..f15d84566b 100644
> --- a/commit-reach.c
> +++ b/commit-reach.c
> @@ -944,6 +944,8 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
>  		}
>  	}
>  
> +	clear_prio_queue(&queue);
> +
>  	clear_commit_marks_many(nr_to, to, PARENT1);
>  	clear_commit_marks_many(nr_from, from, PARENT2);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix memory leak in get_reachable_subset
  2023-06-03  2:02 ` Junio C Hamano
@ 2023-06-03  6:02   ` René Scharfe
  2023-06-04  4:42     ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: René Scharfe @ 2023-06-03  6:02 UTC (permalink / raw)
  To: Junio C Hamano, Derrick Stolee; +Cc: git, Mike Hommey

Am 03.06.23 um 04:02 schrieb Junio C Hamano:
> Mike Hommey <mh@glandium.org> writes:
>
>> Signed-off-by: Mike Hommey <mh@glandium.org>
>> ---
>
> As most lines in the affected function seems to come from your
> fcb2c076 (commit-reach: implement get_reachable_subset, 2018-11-02),
> I'll redirect the review of this patch to you.

Stolee reviewed it already when the patch was sent the first time, here:
https://lore.kernel.org/git/20230421234409.1925489-1-mh@glandium.org/T/#u

>
> Thanks.
>
>>  commit-reach.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/commit-reach.c b/commit-reach.c
>> index 70bde8af05..f15d84566b 100644
>> --- a/commit-reach.c
>> +++ b/commit-reach.c
>> @@ -944,6 +944,8 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
>>  		}
>>  	}
>>
>> +	clear_prio_queue(&queue);

Makes sense: The loop that dequeues would end before consuming all items
when all "to" commits are found to be reachable.

>> +
>>  	clear_commit_marks_many(nr_to, to, PARENT1);
>>  	clear_commit_marks_many(nr_from, from, PARENT2);


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix memory leak in get_reachable_subset
  2023-06-03  6:02   ` René Scharfe
@ 2023-06-04  4:42     ` Junio C Hamano
  2023-06-05 15:50       ` Derrick Stolee
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2023-06-04  4:42 UTC (permalink / raw)
  To: René Scharfe; +Cc: Derrick Stolee, git, Mike Hommey

René Scharfe <l.s.r@web.de> writes:

> Stolee reviewed it already when the patch was sent the first time, here:
> https://lore.kernel.org/git/20230421234409.1925489-1-mh@glandium.org/T/#u

OK.  Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix memory leak in get_reachable_subset
  2023-06-04  4:42     ` Junio C Hamano
@ 2023-06-05 15:50       ` Derrick Stolee
  0 siblings, 0 replies; 9+ messages in thread
From: Derrick Stolee @ 2023-06-05 15:50 UTC (permalink / raw)
  To: Junio C Hamano, René Scharfe; +Cc: git, Mike Hommey

On 6/4/2023 12:42 AM, Junio C Hamano wrote:
> René Scharfe <l.s.r@web.de> writes:
> 
>> Stolee reviewed it already when the patch was sent the first time, here:
>> https://lore.kernel.org/git/20230421234409.1925489-1-mh@glandium.org/T/#u
> 
> OK.  Thanks.

Thanks for finding this link. I saw this patch and immediately thought,
"I made this mistake a _second_ time?"

The patch continues to look good to me.

Thanks,
-Stolee

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-06-05 15:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-03  0:28 [PATCH] Fix memory leak in get_reachable_subset Mike Hommey
2023-06-03  2:02 ` Junio C Hamano
2023-06-03  6:02   ` René Scharfe
2023-06-04  4:42     ` Junio C Hamano
2023-06-05 15:50       ` Derrick Stolee
  -- strict thread matches above, loose matches on Subject: below --
2023-04-21 23:44 Mike Hommey
2023-04-24 15:21 ` Derrick Stolee
2023-04-24 16:09 ` Junio C Hamano
2023-04-24 20:41   ` Mike Hommey

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).