有人可以建议我了解Rails的内存消耗吗?

| 我目前正在开发一个Rails应用程序,这似乎很致命 直到最终必须重新启动iMac上的内存。 我在OSX 10.6上有一个2.66 GHZ处理器和4GB Ram。 当我启动Rails应用程序时,内存消耗显示以下内容 (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 
RSS的速度很酷,为158,860 kb 在对本地主机的一些请求之后,该数字跳升至:
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! 在一般的开发用途下,它会一次又一次地上升, 再次:
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 
我正在使用RVM运行REE 红宝石1.8.7(2010-12-23补丁程序级别330)[i686-darwin10.6.0],MBARI 0x6770,Ruby企业版2011.01 该应用程序正在使用Rails 3.0.6 该应用程序不是特别密集的SQL,几乎有 加载记录时不包括任何关联( 建筑)。 我是说这是内存泄漏还是其他问题? 我应该看看吗? 有人可以提供一些有关如何解决此问题的建议吗? 谢谢! 这是所有已知宝石的完整清单,以防万一 那里的嫌疑犯:
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 => \"http://github.com/CodeMonkeySteve/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
    
已邀请:
cache_classes = false
时,aaasm会非常快速地泄漏内存(这是开发模式下的默认值)。您确实使用了很多宝石,但是我敢打赌aasm是背后的原因。 正如其他人所说,最好使用内存分析器。     
看来您有一些内存泄漏。尝试使用内存探查器戳戳:https://github.com/ice799/memprof     
检查config / newrelic.yml中的内容:
developer_mode: false|true
如果将其设置为“ true”,则可能是内存问题。     

要回复问题请先登录注册