git error : out of memory, malloc failed (tried to allocated X bytes)
This is same as GIT: fatal: Out of memory, malloc failed (tried to allocate 889192448 bytes).
Making below change in .gitconfig solved my problem
[http]
postbuffer = 9999999999
This may work for you as well. Also check your .gitconfig file and which is being used. Also try to free up your RAM, it might also causing the issue.
PJoy
Young engineering school graduate (~M.Sc) Freelance software and web developer. Creative applications enthousiast.
Updated on June 25, 2022Comments
-
PJoy almost 2 years
I recently got the following error log when trying to clone a git repository :
remote: Counting objects: 4607, done. error: git upload-pack: git-pack-objects died with error.B/s fatal: git upload-pack: aborting due to possible repository corruption on the remote side. remote: fatal: Out of memory, malloc failed (tried to allocate 119483755 bytes) remote: aborting due to possible repository corruption on the remote side. fatal: early EOF fatal: index-pack failed
After investigating, it looks like the error is coming from the repo server. I connected via ssh and tried all the following (basically all solutions proposed by the first 2 pages of google results) :
Modified config file by adding the following lines:
[core] packedGitLimit = 512m packedGitWindowSize = 512m [pack] windowMemory = 512m packSizeLimit = 512m deltaCacheSize = 512m threads = 1 window = 0
Tried the following commands which yielded the following error logs:
git repack -a -f -d
Counting objects: 4607, done. fatal: Out of memory, malloc failed (tried to allocate 119483755 bytes)
git fsck
fatal: Out of memory, malloc failed (tried to allocate 119483755 bytes)
git gc
fatal: Out of memory, malloc failed (tried to allocate 119483755 bytes) error: failed to run repack
So basically, it tells me that it is a memory error but I have enough memory :
free -m
total used free shared buffers cached Mem: 12043 10825 1217 0 192 8406 -/+ buffers/cache: 2226 9816 Swap: 258 30 228
ulimit -a
core file size (blocks, -c) 0 data seg size (kbytes, -d) 131072 scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 48169 max locked memory (kbytes, -l) 64 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) unlimited cpu time (seconds, -t) 1800 max user processes (-u) 90 virtual memory (kbytes, -v) 131072 file locks (-x) unlimited
I would appreciate some help, thanks.