git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] revision: free commit buffers for skipped commits

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 30, 2024, 21:27 UTC
Message-ID
<xmqq1q25r99i.fsf@gitster.g>
In-Reply-To
<20240830205331.GA1038751@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> But since this "--skip" case is an easy one-liner, it's worth fixing in
> the meantime.
OK.
Show 10 quoted lines
> diff --git a/revision.c b/revision.c
> index ac94f8d429..2d7ad2bddf 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -4407,6 +4407,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)
>  				c = get_revision_1(revs);
>  				if (!c)
>  					break;
> +				free_commit_buffer(revs->repo->parsed_objects, c);
>  			}

Even if we freed the buffer and then later need it, we'd read the buffer again anyway, so this is a safe thing to do. And because commits skipped in this separate loop will _never_ be given to the caller of get_revision(), this it a reasonable optimization, too.

Will queue.  Thanks.
Previous: Jeff KingNext: Jeff King
Message 3 of 6 in “Unpredictable peak memory usage when using `git log` command”
  1. Yuri KarnilaevAug 30, 2024
  2. revision: free commit buffers for skipped commitsJeff King, Aug 30, 2024
  3. Junio C HamanoAug 30, 2024
  4. Jeff KingAug 30, 2024
  5. Yuri KarnilaevAug 31, 2024
  6. Patrick SteinhardtSep 2, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.