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

Re: [PATCH v2 00/11] built-ins: fix common memory leaks

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 1, 2022, 18:58 UTC
Message-ID
<xmqqh7408xsj.fsf@gitster.g>
In-Reply-To
<cover-v2-00.11-00000000000-20220701T104017Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
>  * Replace 8/11, maybe that solution is going overboard, we could also
>    just drop it from this series...

The "solution" part is to forbid merge_working_tree() to use anything that relies on the topts before it bails out due to unmerged_cache(), that could be done with only a minor reordering of the logic.

And I think that is a reasonable thing to do---if we are looking at an unmerged index, we would not want to run unpack-trees on it at all, so setting up the topts structure does not make much sense before we fully know we cannot bail out early.

On the other hand, it does make the patch go near overboard to extract the topt initialization logic for this single user into a static helper function. If we later find out that my "that is a reasonable thing to do" above is not true, or some setting of topts members need to become conditional, we would probably need to undo that part of this patch.

The latter "going overboard" part is the majority of change. We definitely should *not* discard the essence of this step to stop leaking, but should think about stopping at the smaller change, perhaps?

Having said that, all the other patches in the series looked good.
Thanks, will queue.
Previous: Ævar Arnfjörð Bjarmason
Message 31 of 31 in “built-ins: fix common memory leaks”
  1. 00/11 built-ins: fix common memory leaksÆvar Arnfjörð Bjarmason, Jun 30, 2022
  2. 01/11 check-ref-format: fix trivial memory leakÆvar Arnfjörð Bjarmason, Jun 30, 2022
  3. Junio C HamanoJun 30, 2022
  4. 02/11 clone: fix memory leak in copy_ref() callÆvar Arnfjörð Bjarmason, Jun 30, 2022
  5. Junio C HamanoJun 30, 2022
  6. 03/11 submodule.c: free() memory from xgetcwd()Ævar Arnfjörð Bjarmason, Jun 30, 2022
  7. 04/11 revert: free "struct replay_opts" membersÆvar Arnfjörð Bjarmason, Jun 30, 2022
  8. 05/11 cat-file: fix a memory leak in --batch-command modeÆvar Arnfjörð Bjarmason, Jun 30, 2022
  9. 06/11 merge-file: refactor for subsequent memory leak fixÆvar Arnfjörð Bjarmason, Jun 30, 2022
  10. 07/11 merge-file: fix memory leaks on error pathÆvar Arnfjörð Bjarmason, Jun 30, 2022
  11. 08/11 checkout: add a missing clear_unpack_trees_porcelain()Ævar Arnfjörð Bjarmason, Jun 30, 2022
  12. Junio C HamanoJun 30, 2022
  13. Ævar Arnfjörð BjarmasonJun 30, 2022
  14. Junio C HamanoJun 30, 2022
  15. 09/11 gc: fix a memory leakÆvar Arnfjörð Bjarmason, Jun 30, 2022
  16. 10/11 cat-file: fix a common "struct object_context" memory leakÆvar Arnfjörð Bjarmason, Jun 30, 2022
  17. 11/11 pull: fix a "struct oid_array" memory leakÆvar Arnfjörð Bjarmason, Jun 30, 2022
  18. 00/11 built-ins: fix common memory leaksÆvar Arnfjörð Bjarmason, Jul 1, 2022
  19. 01/11 check-ref-format: fix trivial memory leakÆvar Arnfjörð Bjarmason, Jul 1, 2022
  20. 02/11 clone: fix memory leak in wanted_peer_refs()Ævar Arnfjörð Bjarmason, Jul 1, 2022
  21. 03/11 submodule.c: free() memory from xgetcwd()Ævar Arnfjörð Bjarmason, Jul 1, 2022
  22. 04/11 revert: free "struct replay_opts" membersÆvar Arnfjörð Bjarmason, Jul 1, 2022
  23. 05/11 cat-file: fix a memory leak in --batch-command modeÆvar Arnfjörð Bjarmason, Jul 1, 2022
  24. 06/11 merge-file: refactor for subsequent memory leak fixÆvar Arnfjörð Bjarmason, Jul 1, 2022
  25. 09/11 gc: fix a memory leakÆvar Arnfjörð Bjarmason, Jul 1, 2022
  26. 08/11 checkout: avoid "struct unpack_trees_options" leakÆvar Arnfjörð Bjarmason, Jul 1, 2022
  27. Junio C HamanoJul 1, 2022
  28. 07/11 merge-file: fix memory leaks on error pathÆvar Arnfjörð Bjarmason, Jul 1, 2022
  29. 10/11 cat-file: fix a common "struct object_context" memory leakÆvar Arnfjörð Bjarmason, Jul 1, 2022
  30. 11/11 pull: fix a "struct oid_array" memory leakÆvar Arnfjörð Bjarmason, Jul 1, 2022
  31. Junio C HamanoJul 1, 2022

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.