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

Re: [PATCH] fast-import: fix incomplete conversion with multiple mark files

From
TBTibor Billes <tbilles@gmx.com>
Date
Jun 8, 2020, 15:52 UTC
Message-ID
<alpine.DEB.2.21.2006081739520.9949@serpens>
In-Reply-To
<20200606002241.1578150-1-sandals@crustytoothpaste.net>
Hi,
On Sat, 6 Jun 2020, brian m. carlson wrote:
Show 22 quoted lines
> When ddddf8d7e2 ("fast-import: permit reading multiple marks files",
> 2020-02-22) converted fast-import to handle multiple marks files in
> preparation for submodule support, the conversion was incomplete.  With
> a large number of marks, we would actually modify the marks variable
> even though we had passed in a different variable to operate on.  In
> addition, we didn't consider the fact that the code can replace the mark
> set passed in, so when we did so we happened to leak quite a bit of
> memory, since we never reused the structure we created, instead
> reallocating a new one each time.
>
> It doesn't appear from some testing that we actually produce incorrect
> results in this case, only that we leak a substantial amount of memory.
> To make things work properly and avoid leaking, pass a pointer to
> pointer to struct mark_set, which allows us to modify the set of marks
> when the number of marks is large.
>
> With this patch, importing a dump of git.git with a set of exported
> marks goes from taking in excess of 15 GiB of memory (and being killed
> by the Linux OOM killer) to using a maximum of 1.4 GiB of memory.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>

Thanks for the quickly patching it! I tested the patch and I can confirm this solves the memory leak for me.

Thanks, Tibor Billes

Previous: brian m. carlsonNext: Junio C Hamano
Message 7 of 9 in “git-fast-import out of memory”
  1. Billes TiborJun 5, 2020
  2. brian m. carlsonJun 5, 2020
  3. fast-import: fix incomplete conversion with multiple mark filesbrian m. carlson, Jun 6, 2020
  4. exec: run final pipeline command in a subshell in sh modebrian m. carlson, Jun 6, 2020
  5. 0/1 Run pipeline command in subshell in sh modebrian m. carlson, Jun 6, 2020
  6. brian m. carlsonJun 6, 2020
  7. Tibor BillesJun 8, 2020
  8. Junio C HamanoJun 8, 2020
  9. brian m. carlsonJun 8, 2020

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.