Git gc使用过多的内存,无法完成 [英] Git gc using excessive memory, unable to complete

查看:125
本文介绍了Git gc使用过多的内存,无法完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最终更新和修复:这里的解决方案结果是两件事情的结合:使用Windows Git而不是Cygwin Git作为 Graham Borland 建议,以及Git配置设置 pack.threads = 1 gc.aggressiveWindow = 150



我有一个大的本地Git仓库,SVN仓库的一个 git svn clone ,大约有40,000个提交。我试图在这个版本库上运行 git gc ,并且无处可去:

  $ git gc --auto 
自动打包存储库以获得最佳性能。您也可以
手动运行git gc。有关更多信息,请参阅git help gc。
计数对象:25966,完成。
压缩对象:100%(25249/25249),完成。
fatal:内存不足,malloc失败(试图分配426523986字节)
错误:无法运行重新打包

我在Cygwin中运行Git 1.7.5.1,在一台配备4GB RAM的64位双核Win7机器上运行。 .git 目录目前略高于6.1GB。



我试过运行 git gc --aggressive ,看看更完整的系统是否能够修复它,但没有运气:我收到了与上面类似的消息,尝试了相同的大小 malloc ,但是一个相当高的对象数(508,485计数,493,506压缩)。

我也尝试了 - 分类到我的 .gitconfig 文件的 [pack] 部分;最完整的是从有一种方法来限制内存的数量" git gc" uses?\">另一个StackOverflow问题一>。我的 .gitconfig 现在具有以下相关行,但设置它们似乎没有区别:

  [pack] 
windowMemory = 16m
threads = 1
window = 1
depth = 1
deltaCacheSize = 1

关于如何获得 git gc 我的资料库?



编辑 Mark Longair 建议多一些 .gitconfig 文件更改。我制作了下面的新行。

  [core] 
packedGitWindowSize = 1m
packedGitLimit = 256m
[pack]
packSizeLimit = 128m

编辑2 Michael Krelin 建议增加交换/页面文件大小(WinXP指令在这里,它与Win7类似)。我尝试过,但它没有什么区别,实际上我只增加了可用的最大尺寸,而且看起来好像Windows从不尝试增加它使用的页面文件的大小。



现在我正在研究这是由Cygwin中的内存限制还是内存限制引起的。要检查强加于,我试图以管理员权限运行Cygwin。为了检查内部(看起来更可能),我正在玩 Cygwin的最大内存设置
$ b 编辑3 :尽管我可能更喜欢使用Cygwin ,事实证明Windows Git客户端处理内存问题就好了。看来我会经常回到那个时候,当我的存储库需要整洁的时候。

你可能有更多的运气运行一个本地Windows客户端,例如 msysGit ,而不是在Cygwin内部进行。


Final update and fix: The solution here turned out to be a combination of two things: using Windows Git rather than Cygwin Git as Graham Borland suggested, and the Git config settings pack.threads = 1 and gc.aggressiveWindow = 150.

I have a large local Git repository, a git svn clone of an SVN repository with about 40,000 commits. I'm trying to run git gc over this repository, and getting nowhere:

$ 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'm running Git 1.7.5.1 inside Cygwin on a 64-bit dual-core Win7 machine with 4GB RAM. The .git directory is currently a little over 6.1GB.

I've tried running git gc --aggressive, to see if the more complete system is able to fix it, but no luck: I get a similar message to the above, with the same size attempted malloc, but a considerably higher object count (508,485 counted, 493,506 compressed).

I've also tried—as suggested by Google—assorted twiddles to the [pack] part of my .gitconfig file; the most complete being from another StackOverflow question. My .gitconfig now has the following relevant lines, but setting these appears to have made no difference:

[pack]
        windowMemory = 16m
        threads = 1
        window = 1
        depth = 1
        deltaCacheSize = 1

Any suggestions on how I can get git to gc my repository?

Edit: Mark Longair suggested some more .gitconfig file changes. Which I made, new lines below. But the changes made no difference whatsoever.

[core]
        packedGitWindowSize = 1m
        packedGitLimit = 256m
[pack]
        packSizeLimit = 128m

Edit 2: Michael Krelin suggested increasing the swap/page file size (WinXP instructions here, and it's similar for Win7). I tried that, but it made no difference, and indeed I only increased the maximum size available, and it looks as if Windows never tried to increase the size of the page file it was using.

I'm now looking at whether this was caused by a memory limit within or imposed upon Cygwin. To check "imposed upon", I'm trying running Cygwin with administrator privileges. To check "within" (which looks more likely), I'm having a play with Cygwin's maximum memory settings.

Edit 3: Much though I may prefer using Cygwin, it turns out the Windows Git client deals with the memory issue just fine. Seems I'll be falling back to that every so often when my repository needs a tidy.

解决方案

You might have more luck running a native Windows client such as msysGit, rather than trying to do it inside Cygwin.

这篇关于Git gc使用过多的内存,无法完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆