<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Determining how much memory a require uses</title>
	<atom:link href="http://coderrr.wordpress.com/2009/04/08/determining-how-much-memory-a-require-uses/feed/" rel="self" type="application/rss+xml" />
	<link>http://coderrr.wordpress.com/2009/04/08/determining-how-much-memory-a-require-uses/</link>
	<description>pronounced &#34;coder&#34; not &#34;code err&#34; (extended r optional)</description>
	<lastBuildDate>Sun, 20 Dec 2009 10:03:37 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: coderrr</title>
		<link>http://coderrr.wordpress.com/2009/04/08/determining-how-much-memory-a-require-uses/#comment-1308</link>
		<dc:creator>coderrr</dc:creator>
		<pubDate>Fri, 10 Apr 2009 00:58:08 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=640#comment-1308</guid>
		<description>Yea after looking a little more you&#039;re definitely right.  There are even other magic limits above 8mb which screw up the measurements so allocating X at the beginning doesn&#039;t help.</description>
		<content:encoded><![CDATA[<p>Yea after looking a little more you&#8217;re definitely right.  There are even other magic limits above 8mb which screw up the measurements so allocating X at the beginning doesn&#8217;t help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: coderrr</title>
		<link>http://coderrr.wordpress.com/2009/04/08/determining-how-much-memory-a-require-uses/#comment-1307</link>
		<dc:creator>coderrr</dc:creator>
		<pubDate>Thu, 09 Apr 2009 20:10:25 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=640#comment-1307</guid>
		<description>hey brian thanks for the comment

So yes, I know (a little) about the magic 8 mb and I partly messed with it a little and partly just ignored it.  Maybe you&#039;re right, but consider the two following things.

1) I tried setting $a = &quot;a&quot;*20*1024*1024 at the beginning of mem.rb to allocate 20 megs so we get past this 8mb issue.  The results are almost exactly the same.
2) The issue causing the order to make a difference could be due to both gems requiring the same files.  Of course the first one to require them will be held responsible for their memory, but the latter will not as they have already been required by the first.  That being said, the only two files I see both of those gems requiring take up less than 1mb combined.

So maybe you&#039;re right but can you explain why allocating 20mb before hand doesn&#039;t make a diff?

Counting objects doesn&#039;t seem to be good enough because it doesn&#039;t take into account the memory used by C extensions being loaded.  Also it doesn&#039;t really tell you how much memory each object uses.</description>
		<content:encoded><![CDATA[<p>hey brian thanks for the comment</p>
<p>So yes, I know (a little) about the magic 8 mb and I partly messed with it a little and partly just ignored it.  Maybe you&#8217;re right, but consider the two following things.</p>
<p>1) I tried setting $a = &#8220;a&#8221;*20*1024*1024 at the beginning of mem.rb to allocate 20 megs so we get past this 8mb issue.  The results are almost exactly the same.<br />
2) The issue causing the order to make a difference could be due to both gems requiring the same files.  Of course the first one to require them will be held responsible for their memory, but the latter will not as they have already been required by the first.  That being said, the only two files I see both of those gems requiring take up less than 1mb combined.</p>
<p>So maybe you&#8217;re right but can you explain why allocating 20mb before hand doesn&#8217;t make a diff?</p>
<p>Counting objects doesn&#8217;t seem to be good enough because it doesn&#8217;t take into account the memory used by C extensions being loaded.  Also it doesn&#8217;t really tell you how much memory each object uses.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Mitchell</title>
		<link>http://coderrr.wordpress.com/2009/04/08/determining-how-much-memory-a-require-uses/#comment-1306</link>
		<dc:creator>Brian Mitchell</dc:creator>
		<pubDate>Thu, 09 Apr 2009 19:48:10 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=640#comment-1306</guid>
		<description>That isn&#039;t accurate actually. The primary problem is that Ruby&#039;s heap jumps to just short of 8MB (this can be tuned at compile time for MRI) once it hits its first ceiling on the heap. So this can that one library uses far more than it really does.

For example try to require something like haml then json and then swap them. The order will change that delta. You&#039;d be better off doing something like counting total objects in ObjectSpace. Event that will have problems though because the GC won&#039;t kick in till it needs to and many objects like symbols can be shared.</description>
		<content:encoded><![CDATA[<p>That isn&#8217;t accurate actually. The primary problem is that Ruby&#8217;s heap jumps to just short of 8MB (this can be tuned at compile time for MRI) once it hits its first ceiling on the heap. So this can that one library uses far more than it really does.</p>
<p>For example try to require something like haml then json and then swap them. The order will change that delta. You&#8217;d be better off doing something like counting total objects in ObjectSpace. Event that will have problems though because the GC won&#8217;t kick in till it needs to and many objects like symbols can be shared.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
