[REGRESSION, BISECTED] `git checkout <branch>` started to be memory hog
From: Kirill Smelkov <hidden>
Date: 2016-06-15 22:51:38
Hello up there,
Today I've tried to upgrade to linux-3.0 on my netbook with 1GB of RAM,
with today's Git master (v1.7.6-233-gd79bcd6) and Git was killed by an OOM:
$ git new-workdir linux linux-3.0 linux-3.0.y
Checking out files: ~80% (XXXXX/36783)
Aborted
(with OOM messages in dmesg).
git new-workdir boils down to (uninteresting to the issue) symlinks
setup + final `git checkout -f <branch>` and that final git checkout is
failing.
It turned out that with Git v1.7.6 memory usage for git-checkout
linux-3.0.y as seen in top is
VIRTmax RESmax
~338M ~247M
and for master
VIRTmax RESmax
(both till not killed)
~2200M ~1000M
i.e. it looks like when residential memory usage approaches the amount of
physical RAM, the OOM killer comes into play.
And I've bisected this to b6691092 ("Add streaming filter API"; Junio C
Hamano, May 20 2011; merged to next on Jun 30 2011):
commit b6691092d707860019bbab80eaaf9173ada10586
Author: Junio C Hamano [off-list ref]
Date: Fri May 20 14:33:31 2011 -0700
Add streaming filter API
This introduces an API to plug custom filters to an input stream.
The caller gets get_stream_filter("path") to obtain an appropriate
filter for the path, and then uses it when opening an input stream
via open_istream(). After that, the caller can read from the stream
with read_istream(), and close it with close_istream(), just like an
unfiltered stream.
This only adds a "null" filter that is a pass-thru filter, but later
changes can add LF-to-CRLF and other filters, and the callers of the
streaming API do not have to change.
Signed-off-by: Junio C Hamano [off-list ref]
Hope Git stays usable for us, with not enormous amount of RAM onboard,
and thanks beforehand for fixing,
Kirill