rails开发模式下的内存泄漏

时间:2011-05-26 16:03:05

标签: ruby-on-rails ruby memory-leaks

rails 3.0.7 / REE

我在开发中看到此问题,并且设置config.cache_classes = false可以解决问题。但是,对于开发人员来说,这不是一个可接受的解决方案。

这个问题非常烦人。一些请求泄漏40mb - 因此我的服务器进程非常快速地获得2GB内存,一切都停止了。

bleakhouse显示了很多“active_model / attribute_methods.rb:279”的实例,但我真的不知道该怎么做。也许我的一些AR类正在泄漏什么东西?!

我尝试了一些消除方法的过程,这些过程会产生某种形式的成功。然后我删除了这个功能并继续前进只是为了看到问题再次发生,这让我认为它是一些内部轨道或一个gem /插件。然而,在插件中玩我的宝石消除游戏的过程真的很难,因为如果没有它们,整个控制器都会堆栈跟踪。

我目前的想法是,我需要一些直接的方法来找到这些(这些?)内存泄漏。

此外,对于它的价值,这对于rails 2.3.x来说从来都不是问题。而且我当然不能责怪rails 3.x,因为3.x升级还包括许多gem /插件更改 - 所以谁知道究竟是什么介绍它。

对于解决这个问题的建议和/或对惨淡产出的更好解释将不胜感激。谢谢!

房子输出惨淡:

91323 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:279:__node__
79903 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:278:__node__
28979 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activerecord-3.0.7/lib/active_record/attribute_methods/read.rb:80:__node__
22828 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:278:Proc
19216 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:274:__varmap__
17314 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:404:__node__
16368 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:175:__node__
15112 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/hpricot-0.8.2/lib/hpricot/blankslate.rb:59:__node__
15082 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activesupport-3.0.7/lib/active_support/core_ext/array/wrap.rb:40:Array
14899 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activerecord-3.0.7/lib/active_record/attribute_methods.rb:21:String
14275 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activerecord-3.0.7/lib/active_record/attribute_methods/write.rb:14:__node__
11429 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:274:__node__
11416 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:279:String
11415 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:278:String
11414 /Users/jsharpe/rubypatch/lib/ruby/1.8/set.rb:158:String
11414 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:337:__varmap__
11414 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:280:__node__
11414 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:272:String
11414 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:267:__varmap__
10937 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:407:__node__

0 个答案:

没有答案