<?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>out of memory &#8211; richliu&#039;s blog</title>
	<atom:link href="https://richliu.com/tag/out-of-memory/feed/" rel="self" type="application/rss+xml" />
	<link>https://richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Fri, 30 Sep 2011 17:09:04 +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>OOM &#8211; Out of Memory.</title>
		<link>https://richliu.com/2011/10/01/1128/oom-out-of-memory/</link>
					<comments>https://richliu.com/2011/10/01/1128/oom-out-of-memory/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 30 Sep 2011 17:08:18 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[OOM]]></category>
		<category><![CDATA[out of memory]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1128</guid>

					<description><![CDATA[<p>OOM &#8211; Out of Memory. 筆記文章 目前最好的文章. When Linux Run [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2011/10/01/1128/oom-out-of-memory/">OOM &#8211; Out of Memory.</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>OOM &#8211; Out of Memory.<br />
筆記文章<br />
<span id="more-1128"></span></p>
<p>目前最好的文章.<br />
<a href="http://linuxdevcenter.com/pub/a/linux/2006/11/30/linux-out-of-memory.html" target="_blank" rel="noopener">When Linux Runs Out of Memory</a><br />
另一份不錯的文章<br />
<a href="http://lwn.net/Articles/317814/" target="_blank" rel="noopener">Taming the OOM killer</a><br />
這篇文章有講到可以設權值. userspace 去處理 OOM 問題等等.</p>
<p>原因<br />
或許是 fragment memory 造成的, 也有可能 kernel 佔去太多 memory. </p>
<p>解決方案<br />
完全啟用 Linux kernel over commit 機制.<br />
echo 1 > /proc/sys/vm/overcommit_memory</p>
<p>其他參考文件<br />
<a href="http://www.ibm.com/developerworks/linux/library/l-linux-slab-allocator/" target="_blank" rel="noopener">Dynamic memory management </a><br />
Another approach, called buddy memory allocation, is a faster memory technique that divides memory into power-of-2 partitions and attempts to allocate memory requests using a best-fit approach. When memory is freed by the user, the buddy block is checked to see if any of its contiguous neighbors have also been freed. If so, the blocks are combined to minimize fragmentation. This algorithm tends to be a bit more time efficient but can waste memory due to the best-fit approach.<br />
* 註: Linux 己經使用這個機制. </p>
<p>分析檔案</p>
<p>其他<br />
<a href="http://puschitz.com/pblog/?p=28" target="_blank" rel="noopener">Memory Fragmentation</a><br />
<a href="http://www.win.tue.nl/~aeb/linux/lk/lk-9.html" target="_blank" rel="noopener">Memory</a></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2011/10/01/1128/oom-out-of-memory/">OOM &#8211; Out of Memory.</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/10/01/1128/oom-out-of-memory/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<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>
