Git on Windows, "Out of memory - malloc failed"

You had problems with the repository and tried almost all the possible configuration settings found there, for example. pack.WindowMemory etc. etc.

I believe that someone checked the remote repository in a large file, and now every time I try to pull or click on it, GIT tries to pack it and run out of memory:

Auto packing the repository for optimum performance. You may also run "git gc" manually. See "git help gc" for more information. Counting objects: 6279, done. Compressing objects: 100% (6147/6147), done. fatal: Out of memory, malloc failed (tried to allocate 1549040327 bytes) error: failed to run repack 

Tried git gc and git repack with different options, but keep the same error.

I almost refused and just created a new repo, but thought I'd ask first :)

+57
git windows
Apr 24 2018-12-12T00:
source share
4 answers

I found a solution here that worked for me.

In the .git / config file (client and / or server) I added the following:

 [core] packedGitLimit = 128m packedGitWindowSize = 128m [pack] deltaCacheSize = 128m packSizeLimit = 128m windowMemory = 128m 
+89
09 Oct
source share

For reference (you may have already seen this), the msysgit case related to this issue is ticket 292 .

This offers several workarounds:

  • Disable delta compression worldwide. To do this, you must set pack.window to 0 . Of course, this will make the repository much larger on disk.
  • Disable delta compression for some files. Check the delta flag on the manpage on gitattributes .
  • git config --global pack.threads 1
  • git config --global pack.windowMemory 256m (you have already tried this, but also illustrated in Error displaying warning: suboptimal package from memory )
  • other settings are indicated in the git push fatal section : it is not possible to create a stream: the resource is temporarily unavailable "and" git pull fails with a packet header error if it is bundled.
  • sm4 adds in the comments :

To disable delta compression for specific files, in .git/info/attributes add:

 *.zip binary -delta 

From the Gitattributes man page :

Delta compression will not attempt for blob for paths, the delta attribute is set to false.




Perhaps a simpler workaround would be to somehow reset the history before this large file commits, and redo the other commits from there.

+18
Apr 24 '12 at 7:10
source share

EDIT : & emsp; Since git -v2.5.0 (Aug / 2015) , git-for-windows (formerly MSysGit)
& EPRS; & EPRS; & EPRS; provides 64-bit versions , as Pan.student noted.
& EPRS; & EPRS; & EPRS; In this answer, I advised installing Cygwin 64-bit (with support for the 64-bit version of Git).




I got a similar Out of memory, malloc failed problem using MSysGit when reaching the 4GB barrier:

 > git --version git version 1.8.3.msysgit.0 > file path/Git/cmd/git path/Git/cmd/git: PE32 executable for MS Windows (console) Intel 80386 32-bit > time git clone --bare -v ssh://linuxhost/path/repo.git Cloning into bare repository 'repo.git'... remote: Counting objects: 1664490, done. remote: Compressing objects: 100% (384843/384843), done. remote: Total 1664490 (delta 1029586), reused 1664490 (delta 1029586) Receiving objects: 100% (1664490/1664490), 550.96 MiB | 1.55 MiB/s, done. Resolving deltas: 100% (1029586/1029586), done. fatal: Out of memory, malloc failed (tried to allocate 4691583 bytes) fatal: remote did not send all necessary objects real 13m8.901s user 0m0.000s sys 0m0.015s 

MSysGit crashing after reaching 4 GB barrier

Finally Git 64 bit from Cygwin fix:

 > git --version git version 1.7.9 > file /usr/bin/git /usr/bin/git: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows > time git clone --bare -v ssh://linuxhost/path/repo.git Cloning into bare repository 'repo.git'... remote: Counting objects: 1664490, done. remote: Compressing objects: 100% (384843/384843), done. remote: Total 1664490 (delta 1029586), reused 1664490 (delta 1029586) Receiving objects: 100% (1664490/1664490), 550.96 MiB | 9.19 MiB/s, done. Resolving deltas: 100% (1029586/1029586), done. real 13m9.451s user 3m2.488s sys 3m53.234s 

git 64 bits from Cygwin succeeded

FYI on linuxhost 64 bit:

 repo.git> git config -l user.email=name@company.com core.repositoryformatversion=0 core.filemode=true core.bare=true repo.git> git --version git version 1.8.3.4 repo.git> uname -a Linux linuxhost 2.6.32-279.19.1.el6.x86_64 #1 SMP Sat Nov 24 14:35:28 EST 2012 x86_64 x86_64 x86_64 GNU/Linux 

If my answer does not fix the problem, you can also check these pages:

  • git clone doesn't work even with 5.6 GB of RAM and a 50 GB hard drive
  • The git clone crashes with an out-of-memory error - "fatal: out of memory, malloc failed (tried to allocate 905574791 bytes) / fatal: index-pack failed"
  • git-scanned memory allocation error
  • MSysGit Problem Tracking
+12
Aug 29 '13 at 16:15
source share

This worked for me, but I had to set the parameters via the command line using:

 git --global core\pack [param] value 
0
Jun 16 '16 at 14:23
source share



All Articles