Git fails to push with error 'out of memory'
I'm using gitosis on a server that has a low amount of memory, specifically around 512 MB. When I try to push a large folder (happens to be a backup from an android phone), I get:
me@corellia:~/Configs/$ git push origin master
Counting objects: 18, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (14/14), done.
fatal: Out of memory, malloc failed MiB | 685 KiB/s
error: pack-objects died of signal 13
error: failed to push some refs to 'git@dagobah:Configs'
I've been searching the web, and notably found: http://www.mail-archive.com/[email protected]/msg01747.html as well as http://git.661346.n2.nabble.com/Out-of-memory-error-during-git-push-td5443705.html but these don't seem to help me for two reasons: 1) I am not actually out of memory when I push. When I run 'top' during the push, I get:
24262 git 18 0 16204 6084 1096 S 2 1.2 0:00.12 git-unpack-obje
Also, during the push if I run /head/meminfo, I get:
MemTotal: 524288 kB
MemFree: 289408 kB
Buffers: 0 kB
Cached: 0 kB
SwapCached: 0 kB
Active: 0 kB
Inactive: 0 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 524288 kB
So, it seems that I have enough memory free, but it's actually still failing, and I'm not enough of a git guru to figure out what is happening. I would appreciate it if someone could give me a hand here and tell me what could be causing this problem, and what I can do to solve it.
Thanks!
EDIT:
The output of running the ulimit -a
command:
scottj@dagobah:~$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 204800
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 204800
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
EDIT:
The git objects and sizes are:
313796 .git/objects/88/7ce48679f885af4c466d4ddccef9a9954a9de6
224276 .git/objects/18/261f6a52926a756c7ecb453e025d1f25937026
6248 .git/objects/63/a0b4e622c893d3dcc162052b43301030d0c86d
5608 .git/objects/a2/0c65987656cba591171549752eb97f0207fec8
2608 .git/objects/pack/pack-3be8300f69b67fa8fa687df84bbd9b8c96e86c8e.pack
28 .git/objects/pack/pack-3be8300f69b67fa8fa687df84bbd9b8c96e86c8e.idx
24 .git/objects/c9/8909563ec60369d69ac2d317af25a44c9fc198
24 .git/objects/5d/1f74bd9bc4c575a7eeec08d59916d9829068d1
24 .git/objects/53/edad79cb051f5e7864d9d3339fa59990ccfe2d
8 .git/objects/80/dd50c7a314950e5a1f56c0210b0a91f48ee792
It is a bit of a stretch but give this a try
git -c core.packedGitWindowSize=32m -c core.packedGitLimit=256m push origin master
This overrides a couple of parameters that limit the number of bytes mapped from files. These are the defaults used for a 32-bit system, the 64-bit defaults are much larger. I'm speculating you are using a 64-bit system, which is causing git to use very large defaults, but there are resource constraints (perhaps from running in a VM) that trigger the error.
These configuration parameters and values came from http://schacon.github.com/git/git-config.html