Can someone advise me on Rails memory consumption?

I’m working on a Rails application at the moment which seems to kill
the memory on my iMac until I eventually have to restart.
I have a 2.66 GHZ processor with 4GB Ram on OSX 10.6.

When I boot the rails app, the memory consumption shows the following
(ps aux | grep rails):

Gavin 726 0.0 3.8 2590812 158860 s000 S+ 9:27am
0:09.90 /Users/Gavin/.rvm/rubies/ree-1.8.7-2011.01/bin/ruby script/
rails s

The RSS is at a cool 158,860 kb

After a few requests to localhost, this number jumps up to:

Gavin 726 0.0 14.1 3031792 592888 s000 S+ 9:27am
0:27.00 /Users/Gavin/.rvm/rubies/ree-1.8.7-2011.01/bin/ruby script/
rails s

592,888 kb

and with general development use, it goes up again and again and
again:

Gavin 726 1.5 25.0 3487516 1050180 s000 S+ 9:27am
0:59.29 /Users/Gavin/.rvm/rubies/ree-1.8.7-2011.01/bin/ruby script/
rails s

I’m running REE using RVM

ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10.6.0], MBARI
0x6770, Ruby Enterprise Edition 2011.01

The app is using Rails 3.0.6

The application is not particularly SQL intensive and there are almost
no associations included when records are loaded (not required in the
architecture).

Am I right in saying this is a memory leak or is there something else
I should be looking at?

Can anybody offer some advice on how I can solve this?

Thanks

Here’s a full list of the gems used just incase there are any known
suspects in there:
source ‘http://rubygems.org

gem “omniauth”, “0.2.0”
gem “fb_graph”
gem ‘rails’, ‘>=3.0.6’
gem ‘mysql2’
gem “delayed_job”
gem “rvm”
gem “whenever”
gem “less”
gem “bcrypt-ruby”, :require => “bcrypt”
gem “twitter”
gem “paperclip”
gem “aws-s3”
gem “RedCloth”
gem “decent_exposure”, :git => “git://github.com/voxdolo/
decent_exposure.git”

Application monitoring services

gem ‘hoptoad_notifier’, “>=2.4.5”
gem “newrelic_rpm”, “>=2.13.4”
gem “yahoo-weather”, “1.2.0”, :require => false
gem “json”, “~>1.4.6”
gem ‘will_paginate’, :git => “git://github.com/mislav/
will_paginate.git”, :branch => “rails3”
gem ‘acts-as-taggable-on’
gem “aasm”, “>=2.2.0”, :require => “aasm”
gem ‘thinking-sphinx’, ‘2.0.2’, :require => ‘thinking_sphinx’

These gems are not required on the Staging/Production server

group :development, :test do
gem ‘capistrano’
gem “capistrano-ext”
gem “nifty-generators”
gem ‘factory_girl_rails’, :git => “CodeMonkeySteve (Steve Sloan) · GitHub
factory_girl_rails.git”

Keep on top of the latest RSpec Gems

gem “rspec-rails”, :git => “git://github.com/rspec/rspec-
rails.git”
gem “rspec”, :git => “git://github.com/rspec/rspec.git”
gem “rspec-core”, :git => “git://github.com/rspec/rspec-
core.git”
gem “rspec-expectations”, :git => “git://github.com/rspec/rspec-
expectations.git”
gem “rspec-mocks”, :git => “git://github.com/rspec/rspec-
mocks.git”
gem ‘shoulda’
gem “mocha”

gives us the mock_model method for mocha

gem ‘rspec-rails-mocha’, ‘~> 0.3.0’
gem “faker”
gem “autotest”, “>=4.4.6”
gem “autotest-growl”
gem “autotest-rails”
gem “database_cleaner”
gem “redgreen”
gem “launchy”
gem “faker”
gem ‘ruby-debug’
gem “rcov”
gem “rdoc”
gem “ruby-prof”
end

On Thu, Apr 14, 2011 at 3:34 AM, Gavin M.
[email protected]wrote:

and with general development use, it goes up again and again and
0x6770, Ruby Enterprise Edition 2011.01
Can anybody offer some advice on how I can solve this?
gem ‘rails’, ‘>=3.0.6’
gem “decent_exposure”, :git => "git://github.com/voxdolo/
gem “aasm”, “>=2.2.0”, :require => “aasm”

Keep on top of the latest RSpec Gems

gem “mocha”
gem “faker”
gem ‘ruby-debug’
gem “rcov”
gem “rdoc”
gem “ruby-prof”
end

I don’t think the issue is Rails but REE. Have you run the same Rails
app
using regular Ruby and checked the memory usage?

B.

Still having the same issue running the application on good ole system
ruby.

Assuming there is a memory leak here, can anybody advise me on how I
can find the leak?

Otherwise, any other ideas?

Im having the same problem. Our Gemfile is very similar to yours. It
started happening when we upgraded from 3.0.5 -> 3.0.6 and even in 3.0.7
as well. After rolling back to 3.0.5 the memory consumption for our
dev environment went way down.

Someone should post this on rails lighthouse…