开发者

rails memory leak in development mode

rails 3.0.7 / REE

I'm seeing this problem in development and setting config.cache_classes = false fixes the problem. However, that's not an acceptable solution for dev.

This issue is highly annoying. Some requests leak 40mb - as a result my server process gets to 2GB of memory very very rapidly and everything grinds to a halt.

bleakhouse shows lots of instances of "active_model/attribute_methods.rb:279" but I don't really know what to make of that. Maybe some AR class of mine is leaking something?!

I've tried some process of elimination approaches which results in some form of success. I then strip out that feature and move on only to see the issue reoccur which makes me think it's some rails internal or a gem/plugin. However, it's really difficult to play process of elimination games w/ my gems in plugins, since without them whole controllers will stacktrace.

My current thought is that I need some direct approach to finding this(these?) memory leak.

Also, for what it's worth, this was never an issue with rails 2.3.x. And I certainly can't blame rails 3.x since the 3.x upgrade also included numerous gem/plugin changes as well -- so who knows exactly what introduced it.

Suggestions for tackling this and/or a better interpretation of the bleakhouse output would be appreciated. Thanks!

bleak house output:

91323 /Users/jsharpe/.rvm/gems/ruby-1.8.7-p334@testapp/gems/activemodel-3.0.7/lib/active_model/attri开发者_运维技巧bute_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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜