BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Find Memory Leaks in Your Rails Application with BleakHouse

| by Sebastien Auvray Follow 0 Followers on May 10, 2007. Estimated reading time: 1 minute |

While the agility of Rails has never been in doubt, there is often controversy about its performance.

DTrace is a nice dynamic framework to analyze the behavior of your application as the Twitter team proved recently. A new tool in the battle for memory issues is the Rails plugin BleakHouse by Evan Weaver. One of the advantages of a dynamic language like Ruby is its ability to introspect: examining the state of your application from within the application itself. But one has to be careful when using ObjectSpace (the Ruby garbage collected object heap explorer). Indeed, BleakHouse in a first version took advantage of ObjectSpace to take snapshots of Rails application, but Evan Weaver found out ObjectSpace is not quantum: using it changes its own state.

BleakHouse now comes with a leak-free C implementation that directly instruments the heap. The advantage is that it now charts actual memory usage (swap, real, and combined) and it’s faster than before.

It produces charts of references by controller, by action, and by object class.

Bleakhouse needs gruff (and therefore rmagick). Since it is a C implementation, BleakHouse also needs a patched Ruby binary to monitor your application. Once the plugin installed and your environment set as production, your application will be tracked. At the end, you will run a rake goal to generate the graphs:

Bleakhouse reminds InfoQ of the fifth suggestion from Charles Nutter about making Ruby better: getting rid of ObjectSpace, all the more when at the end one has to patch its vm to do some monitoring.

ObjectSpace harms Ruby by limiting the flexibility of its garbage collecting and threading subsystems, and should be eliminated.

Java has a lot of efficient heap analyser, you could wonder where are all the RProbe, RProfiler for Ruby? I guess with time, new VMs, more companies involved, such tools should arrive...

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Been looking for a tool like this by Jan Fredrik Øveraasen

can`t wait for using this for my work in progress ruby application:)

Tools for Ruby by Stephen Kellett

The article has the question "Where are all the RProbe, RProfiler for Ruby?".

There have been coverage, memory, profiler and flow tracer tools for Ruby for several years now. Software Verification provide them. They have the same user interface as their tools for other languages, so if you know the C++ or JavaScript version of one of the tools you automatically know how to use the Ruby version.

Stefan Kaes wrote about Ruby Performance Validator in his InfoQ article on Ruby Performance. The other tools are Ruby Memory Validator, Ruby Coverage Validator and two in beta for flow tracing and thread analysis.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

2 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT