git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: void f <fv729164860@gmail.com>
To: git@vger.kernel.org
Subject: Bug report. Out of memory about git checkout.
Date: Wed, 22 Jun 2022 21:53:26 +0800	[thread overview]
Message-ID: <CADRR3BF7rY0Z3UTJf223+ALns06Re+vxeNuhx9sKNFxu73=EWw@mail.gmail.com> (raw)

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.

             reply	other threads:[~2022-06-22 13:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 13:53 void f [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-06-22 13:55 Bug report. Out of memory about git checkout void f

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADRR3BF7rY0Z3UTJf223+ALns06Re+vxeNuhx9sKNFxu73=EWw@mail.gmail.com' \
    --to=fv729164860@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).