Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GIT: fatal: Out of memory, malloc failed (tried to allocate 889192448 bytes)

Tags:

git

I have this error while pushing my project to tfs GIT.

fatal: Out of memory, malloc failed (tried to allocate 889192448 bytes)

like image 932
Joe Sleiman Avatar asked Dec 13 '16 12:12

Joe Sleiman


3 Answers

I fixed this by decreasing the postbuffer size:

[http]
    postbuffer = 5m
like image 100
David Pascoe-Deslauriers Avatar answered Oct 24 '22 02:10

David Pascoe-Deslauriers


Edit .git/config on Unix or .gitconfig on Windows and modifiy the following params. By running git config --list --show-origin you could locate your gitconfigs.

[core]
  packedGitLimit = 128m
  packedGitWindowSize = 128m

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

[http]
  postbuffer = 5m

If you are using git via CLI ensure you restart your shell/terminal after you changed this settings.

like image 16
lin Avatar answered Oct 24 '22 04:10

lin


So what it basically requires is the free memory of 889192448 bytes (889MB Approx). This error occurs for 2 reasons

  • When your RAM is running out of space.
  • Memory limit set for Git is not meeting the requirement.

To check the free memory on Linux based systems.

free -h

If free memory is greater than the required memory, then you don't have to do anything here, otherwise you need to add the swap memory to increase the available free space on RAM.

If the free memory of RAM is already in place for the required memory, then you need to configure your git to utilise this. You do this with the following:

git config pack.packSizeLimit 1g
git config pack.deltaCacheSize 1g
git config pack.windowMemory 1g
git config core.packedGitLimit 1g
git config core.packedGitWindowSize 1g

Hope this helps.

like image 5
user3785966 Avatar answered Oct 24 '22 02:10

user3785966