Linux, 工作, 生活, 家人

Software

git gc: Out of memory, malloc failed

不知道什麼時候, 跑 Git gc 的時候, 會出現這樣的訊息.
但是這並不是主系統記憶體太小(事實上我有 8G).

解決方案是在 repack 時, 在 memory scale 使用較小的 memory
這樣就不會因為 small object 太多, 太快吃掉所有的 memory .

語法
[BASH]
$ git repack -adf –window=memory
[/BASH]

跑完一次 repack 之後, 接下來就可以正常跑 GC 了.
以下是我的 Log
[BASH]
root@rl-desktop:/data/git-pool/vega-base/trunk# git gc
Counting objects: 174589, done.
Delta compression using up to 4 threads.
fatal: Out of memory, malloc failed09843)
error: failed to run repack
root@rl-desktop:/data/git-pool/vega-base/trunk# git repack -adf –window=5
Counting objects: 174589, done.
Delta compression using up to 4 threads.
warning: suboptimal pack – out of memory)
fatal: Out of memory, malloc failed69814)
root@rl-desktop:/data/git-pool/vega-base/trunk# git repack -adf –window=2
Counting objects: 174589, done.
Delta compression using up to 4 threads.
fatal: Out of memory, malloc failed69814)
root@rl-desktop:/data/git-pool/vega-base/trunk# git repack -adf –window=1
Counting objects: 174589, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (169814/169814), done.
Writing objects: 100% (174589/174589), done.
Total 174589 (delta 77228), reused 0 (delta 0)
root@rl-desktop:/data/git-pool/vega-base/trunk# git gc
Counting objects: 174589, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (92586/92586), done.
Writing objects: 100% (174589/174589), done.
Total 174589 (delta 77228), reused 174589 (delta 77228)
root@rl-desktop:/data/git-pool/vega-base/trunk#
[/BASH]

發佈留言