Final update and correction . The solution here turned out to be a combination of two things: using Windows Git rather than Cygwin Git like Graham Borland and setting Git configuration pack.threads = 1 and gc.aggressiveWindow = 150 .
I have a large local Git repository, git svn clone of an SVN repository with about 40,000 commits. I am trying to run git gc through this repository and not getting anywhere:
$ git gc --auto Auto packing the repository for optimum performance. You may also run "git gc" manually. See "git help gc" for more information. Counting objects: 25966, done. Compressing objects: 100% (25249/25249), done. fatal: Out of memory, malloc failed (tried to allocate 426523986 bytes) error: failed to run repack
I am running Git 1.7.5.1 inside Cygwin on a 64-bit Win7 dual-core machine with 4 GB of RAM. The .git directory is currently slightly smaller than 6.1 GB.
I tried to run git gc --aggressive to find out if a more complete system can fix it, but no luck: I get a similar message above, with the same size as when I tried malloc , but a significantly higher object (508 485 samples , 493,506 compressed).
I also tried - as suggested by various Google tricks for the [pack] part of my .gitconfig file; the most complete of https://stackoverflow.com/a/312960/ My .gitconfig now has the following matching lines, but setting these options doesn't matter:
[pack] windowMemory = 16m threads = 1 window = 1 depth = 1 deltaCacheSize = 1
Any suggestions on how I can get git in gc my repository?
Edit : Mark Longer suggested a few more changes to the .gitconfig file, What I did, new lines below. But the changes have not changed anything.
[core] packedGitWindowSize = 1m packedGitLimit = 256m [pack] packSizeLimit = 128m
Edit 2 : Michael Krelin suggested increasing the page / page file size (WinXP instructions are here , and it looks like Win7). I tried this, but it didnβt matter, and indeed, I only increased the maximum available size, and it looks like Windows never tried to increase the size of the page file used.
Now I look to see if this was caused by a memory constraint inside or imposed by Cygwin. To check for "overlaid", I'm trying to run Cygwin with administrator privileges. To check the "inside" (which looks more likely), I have a game with Cygwin Maximum Memory Settings .
Change 3 . Much, although I may prefer to use Cygwin, it turns out that the Windows Git client deals with the memory issue just fine. It seems that I will come back to this so often when my repository needs to be neat.