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

Bug report. Out of memory about git checkout.

From
VFvoid f <fv729164860@gmail.com>
Date
Jun 22, 2022, 13:53 UTC
Message-ID
<CADRR3BF7rY0Z3UTJf223+ALns06Re+vxeNuhx9sKNFxu73=EWw@mail.gmail.com>
How to repeat:
env:

git version: 2.36.1 os : center os memory 8G

When you execute "git checkout .” to chekout a very large lfs-file, Which is larger than your memory. It would throw “Out of memory, realloc failed” exception.

reason of the bug:

When you execute git checkout, Which have to checkout a lfs-file to the worktree. Git would execute "convert.c apply_multi_file_filter()" to convert lfs pointer from git-object to the lfs file. It will execute a subprocess to convert this file. But It is strange that git would read all of the file into memory When finish the git-lfs subprocess. (The code is about pkt-line.c read_packetized_to_strbut()). Lfs usually is a very large file even more than the memory. So it would throw out of memory exception.

With this bug, it would have trouble to use sparse-chekout in a repository with large lfs-file. Because you must init the repository first and set the sparse-chekout config, than use git pull/merge/checkout to checkout your subset worktree. It would out of memory when you checkout it.

I think git don’t need to read all of the file in memory. It can use a stream to finish the checkout.

Message 1 of 1 in “Bug report. Out of memory about git checkout.”
  1. void fJun 22, 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.