<?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>Coffee Powered &#187; memory</title>
	<atom:link href="http://www.coffeepowered.net/tag/memory/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.coffeepowered.net</link>
	<description>code and content</description>
	<lastBuildDate>Sun, 05 Sep 2010 20:38:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Announcing Scrap</title>
		<link>http://www.coffeepowered.net/2009/03/24/announcing-scrap/</link>
		<comments>http://www.coffeepowered.net/2009/03/24/announcing-scrap/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 10:02:09 +0000</pubDate>
		<dc:creator>Chris Heald</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[metal]]></category>
		<category><![CDATA[objectspace]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.coffeepowered.net/?p=159</guid>
		<description><![CDATA[I do a lot of memory and garbage analysis on my Rails apps, and in upgrading to Rails 2.3, I discovered a practical use for the new Rails Metal middleware. Dumping memory stats to my log was just sorta unreadable in a practical scenario, and was more or less entirely unusable in production. Fortunately, Metal [...]]]></description>
			<content:encoded><![CDATA[<p>I do a lot of memory and garbage analysis on my Rails apps, and in upgrading to Rails 2.3, I discovered a practical use for the new <a href="http://weblog.rubyonrails.org/2008/12/17/introducing-rails-metal">Rails Metal</a> middleware. Dumping memory stats to my log was just sorta unreadable in a practical scenario, and was more or less entirely unusable in production. Fortunately, Metal provides a really easy way to output readable information to the browser without invoking the full Rails stack. (It&#8217;s also an excuse to write a Metal endpoint because it&#8217;s new and shiny, but that&#8217;s beside the point.)</p>
<p>It&#8217;s up at <a href="http://github.com/cheald/scrap/tree/master">github</a> &#8211; installation is dead easy (assuming you&#8217;re on Rails 2.3+, of course) &#8211; just install the plugin, restart your app, and hit <code>&lt;your url&gt;/stats/scrap</code> in your browser. Bam, instant juicy memory goodness about your app at your fingertips. If you&#8217;d like an example of the output, good news! Check it out at <a href="http://tachyonsix.com/scrap.htm">http://tachyonsix.com/scrap.htm</a>.</p>
<p>You can use it to troubleshoot heap leaks &#8211; just run a few requests, hit your Scrap URL, and see what your deltas look like. Seeing a huge growth in a certain type of object? Chances are pretty good that you have a heap leak, and can start tracking it down.</p>
<p>The request history can help you locate certain actions that might be causing spikes in memory usage. It&#8217;ll show the last N requests, along with memory and heap statistics before each request. If there&#8217;s a consistent memory usage leap after a certain action, chances are that it&#8217;s doing something naughty.</p>
<p>Want to get a bigger picture on what objects are hanging around? You can use the <code>config/scrap.yml</code> file to get Scrap to spit out more detailed reports on instances of a given class. There&#8217;s full documentation on it in the README.</p>
<p>Anyhow, give it a shot, let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coffeepowered.net/2009/03/24/announcing-scrap/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Quick tip &#8211; use anonymous blocks!</title>
		<link>http://www.coffeepowered.net/2008/10/09/quick-tip-use-anonymous-blocks/</link>
		<comments>http://www.coffeepowered.net/2008/10/09/quick-tip-use-anonymous-blocks/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 05:30:21 +0000</pubDate>
		<dc:creator>Chris Heald</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[blocks]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.coffeepowered.net/?p=75</guid>
		<description><![CDATA[In tracking down a memory leak in one of our Rails apps today, I ran across an interesting post detailing the difference between anonymous and named blocks in Ruby, and the performance differences therein. It&#8217;s definitely worth a look, especially if you&#8217;re running in a complex environment, where new closures will be large and unwieldy. [...]]]></description>
			<content:encoded><![CDATA[<p>In tracking down a memory leak in one of our Rails apps today, I ran across an <a href="http://blog.pluron.com/2008/02/rails-faster-as.html">interesting post</a> detailing the difference between anonymous and named blocks in Ruby, and the performance differences therein.</p>
<p>It&#8217;s definitely worth a look, especially if you&#8217;re running in a complex environment, where new closures will be large and unwieldy. It&#8217;s very easy, too. Any time you use:</p>
<pre class="brush: ruby;">
def note(text, options = {}, &amp;block)
  options[:class] = ((options[:class] || &quot;&quot;) + &quot; form-note&quot;).strip
  content_tag(:div, text, options, &amp;block)
end
</pre>
<p>Instead, don&#8217;t explicitly name the block parameter; just yield to it, and you prevent all the messiness of creating a new Proc object.</p>
<pre class="brush: ruby;">
def note(text, options = {})
  options[:class] = ((options[:class] || &quot;&quot;) + &quot; form-note&quot;).strip
  content_tag(:div, text, options) {|*block_args| yield(*block_args) if block_given? }
end
</pre>
<p>I don&#8217;t have benchmarks just yet, but anecdotally it has definitely slowed instance memory consumption in my apps. It&#8217;s worth taking a look at!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coffeepowered.net/2008/10/09/quick-tip-use-anonymous-blocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using memcached
Database Caching 10/18 queries in 0.011 seconds using memcached

Served from: www.coffeepowered.net @ 2010-09-07 06:43:26 -->