[Ruby] Memory profiling rails

Scott Windsor swindsor at gmail.com
Fri Aug 8 10:11:31 PDT 2008


I'm trying to track down a memory leak in my rails app - on certain page
requests the memory usage is jumping 20-30M and never regaining (even after
explict GC calls are made).

I've been looking at various options for helping track down this leak.
Right now I'm fairly certain it's not from a leaky c-extension (but I could
be wrong), so I'm up for investigating leaks in ruby first.

I'd like to use ruby-prof, which requires a patched version of ruby.  I've
patched ruby and installed in a alternate location, but it doesn't seem to
pick up any gems - do I have to keep a seperate set of gems for this
install?

Here's the output from trying to run the patched ruby below (I'm using
ubuntu hardy & mongrel):

$ /opt/ruby-gc-patch/bin/ruby ./script/server
Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again:
http://rubygems.rubyforge.org
$ /opt/ruby-gc-patch/bin/ruby -I/opt/ruby-gc-patch/lib ./script/server
Missing the Rails 2.1.0 gem. Please `gem install -v=2.1.0 rails`, update
your RAILS_GEM_VERSION setting in config/environment.rb for the Rails
version you do have installed, or comment out RAILS_GEM_VERSION to use the
latest version installed.
$ /opt/ruby-gc-patch/bin/gem1.8 list | grep rails
rails (2.1.0, 2.0.2, 1.2.6)

I can't seem to figure out why my alternate gem install can't find the gems
when requiring, but can find them when I run "gem list".  Does anyone know
how to work through this?

Thanks in advance,
- scott



More information about the Ruby mailing list