So your Rails app is taking up a lot of RAM. What else is new? But perhaps this isn't just the way things are. Perhaps your application's memory footprint is being enlarged by one or more bloated gems.

I recently stumbled across a very cool project by Richard Schneeman. It's called derailed, and is a collection of automatic benchmarking tools. Here's the github repo.

All you need to do is add it to your gemfile like so:

gem 'derailed', group: :development
gem "stackprof", group: :development

Then you can see exactly how much memory each of your gems requires at compile time:

Use the bundle:mem command to see how much ram each of your gems uses at compile time Use the bundle:mem command to see how much ram each of your gems uses at compile time

You can also see how many objects are allocated by your gems at load time.

Use the bundle:objects to see information about object allocation at load time Use the bundle:objects to see information about object allocation at load time

There are even tools for measuring memory usage as your application runs. I haven't had a chance to check these out personally yet, since you have to be able to run your app in production mode on your development computer.