Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git out of memory on checkout

Tags:

git

realloc

I have cloned a large repo and got an error (after several attempts)

Clone succeeded, but checkout failed

When trying to fix this with

git checkout -f HEAD

an error comes back

Fatal: Out of memory, realloc failed2

I've already set some memory limits higher because the cloning also ran into problems by setting

git config pack.WindowMemory 256m && git config pack.packSizelimit 256m

Based on advice below from Punit Vara (below) I've also edited the .git/config to:

[core]
packedGitLimit = 128m
  packedGitWindowSize = 128m

[pack]
  deltaCacheSize = 128m
  packSizeLimit = 128m
  windowMemory = 128m

And I've tried changing these values to: 128m, 256m, 512m, 1024m. This didn't work for me. I still get the same error that seems to appear at 41%.

Anyone has experience with this or any idea where this is going wrong and/or what can be done to solve this? Thanks.

like image 976
PeterSG Avatar asked Dec 18 '15 16:12

PeterSG


3 Answers

I encountered the same annoying problem after my server was updated to 64Bit architecture. The OS memory limit for git was at 600m.

core.preloadIndex = false

finally did the trick for me. It defaults to true since git version 2.1

like image 166
Raffael Reichelt Avatar answered Nov 16 '22 23:11

Raffael Reichelt


I got this error message: "Fatal: Out of memory, realloc failed2 " when trying to use git add --all. The reason is that I attempted to add a very large csv file (>1.6 GB). Git/Github does not allow to upload such a large file. As a solution you can put the file on gitignore or move the file to another directory not connected to git.

like image 42
Philipp Schwarz Avatar answered Nov 16 '22 23:11

Philipp Schwarz


Try this:

git gc --auto --prune=today --aggressive 
git repack 
git config --global http.postbuffer 524288000 
git config --global pack.windowMemory 256m

Found on git push Out of memory, malloc failed.

like image 1
Nhysi Avatar answered Nov 17 '22 01:11

Nhysi