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

Re: [PATCH 2/3] ls-remote: release memory instead of UNLEAK

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 11, 2018, 01:20 UTC
Message-ID
<xmqqva69i8j7.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<0102016657e7d068-16e15ab5-335e-4a2a-8bbb-bf2242514ad2-000000@eu-west-1.amazonses.com>
Olga Telezhnaya <olyatelezhnaya@gmail.com> writes:
Show 6 quoted lines
> Use ref_array_clear() to release memory instead of UNLEAK macros.
>
> Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
> ---
>  builtin/ls-remote.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

OK, this is immediately before the command exits, and we have a way to clear and release the resource, so it is obvious we should use it.

Good.
Show 16 quoted lines
>
> diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
> index 1a25df7ee15b4..6a0cdec30d2d7 100644
> --- a/builtin/ls-remote.c
> +++ b/builtin/ls-remote.c
> @@ -151,6 +151,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
>  	}
>  
>  	UNLEAK(sorting);
> -	UNLEAK(ref_array);
> +	ref_array_clear(&ref_array);
>  	return status;
>  }
>
> --
> https://github.com/git/git/pull/538
Previous: Olga TelezhnayaNext: Olga Telezhnaya
Message 3 of 11 in “ref-filter: free memory from used_atom”
  1. 1/3 ref-filter: free memory from used_atomOlga Telezhnaya, Oct 9, 2018
  2. 2/3 ls-remote: release memory instead of UNLEAKOlga Telezhnaya, Oct 9, 2018
  3. Junio C HamanoOct 11, 2018
  4. 3/3 ref-filter: free item->value and item->value->sOlga Telezhnaya, Oct 9, 2018
  5. Junio C HamanoOct 11, 2018
  6. Jeff KingOct 12, 2018
  7. Junio C HamanoOct 11, 2018
  8. Junio C HamanoOct 12, 2018
  9. Jeff KingOct 18, 2018
  10. Junio C HamanoOct 18, 2018
  11. Оля ТележнаяOct 18, 2018

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.