<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gc &#8211; richliu&#039;s blog</title>
	<atom:link href="https://richliu.com/tag/gc/feed/" rel="self" type="application/rss+xml" />
	<link>https://richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Fri, 05 Aug 2011 03:44:36 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>git gc: Out of memory, malloc failed</title>
		<link>https://richliu.com/2011/04/22/1050/git-gc-out-of-memory-malloc-failed/</link>
					<comments>https://richliu.com/2011/04/22/1050/git-gc-out-of-memory-malloc-failed/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 22 Apr 2011 11:46:47 +0000</pubDate>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[gc]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[out of memory]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1050</guid>

					<description><![CDATA[<p>不知道什麼時候, 跑 Git gc 的時候, 會出現這樣的訊息. 但是這並不是主系統記憶體太小(事實上我有 8 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2011/04/22/1050/git-gc-out-of-memory-malloc-failed/">git gc: Out of memory, malloc failed</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>不知道什麼時候, 跑 Git gc 的時候, 會出現這樣的訊息.<br />
但是這並不是主系統記憶體太小(事實上我有 8G).</p>
<p><span id="more-1050"></span></p>
<p>解決方案是在 repack 時, 在 memory scale 使用較小的 memory<br />
這樣就不會因為 small object 太多, 太快吃掉所有的 memory .</p>
<p>語法<br />
[BASH]<br />
$ git repack -adf &#8211;window=memory<br />
[/BASH]</p>
<p>跑完一次 repack 之後, 接下來就可以正常跑 GC 了.<br />
以下是我的 Log<br />
[BASH]<br />
root@rl-desktop:/data/git-pool/vega-base/trunk# git gc<br />
Counting objects: 174589, done.<br />
Delta compression using up to 4 threads.<br />
fatal: Out of memory, malloc failed09843)<br />
error: failed to run repack<br />
root@rl-desktop:/data/git-pool/vega-base/trunk# git repack -adf &#8211;window=5<br />
Counting objects: 174589, done.<br />
Delta compression using up to 4 threads.<br />
warning: suboptimal pack &#8211; out of memory)<br />
fatal: Out of memory, malloc failed69814)<br />
root@rl-desktop:/data/git-pool/vega-base/trunk# git repack -adf &#8211;window=2<br />
Counting objects: 174589, done.<br />
Delta compression using up to 4 threads.<br />
fatal: Out of memory, malloc failed69814)<br />
root@rl-desktop:/data/git-pool/vega-base/trunk# git repack -adf &#8211;window=1<br />
Counting objects: 174589, done.<br />
Delta compression using up to 4 threads.<br />
Compressing objects: 100% (169814/169814), done.<br />
Writing objects: 100% (174589/174589), done.<br />
Total 174589 (delta 77228), reused 0 (delta 0)<br />
root@rl-desktop:/data/git-pool/vega-base/trunk# git gc<br />
Counting objects: 174589, done.<br />
Delta compression using up to 4 threads.<br />
Compressing objects: 100% (92586/92586), done.<br />
Writing objects: 100% (174589/174589), done.<br />
Total 174589 (delta 77228), reused 174589 (delta 77228)<br />
root@rl-desktop:/data/git-pool/vega-base/trunk#<br />
[/BASH]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2011/04/22/1050/git-gc-out-of-memory-malloc-failed/">git gc: Out of memory, malloc failed</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2011/04/22/1050/git-gc-out-of-memory-malloc-failed/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
