We recently spotted strange behavior with Rails 2.3. For some reason last 3
requests/responses (and all connected objects - controller, views,
controller's instance variables, etc) are always present in memory in
This is how we see the problem. Create an empty Rails application with a
simple controller like this:
=== app/controllers/default_controller.rb ===
class DefaultController < ApplicationController
@a = A.new
x = 0
ObjectSpace.each_object(A) do |o|
render :text => "Hello!"
Now launch the application (in a production mode) and perform requests.
You'll see that:
- after first request: there's one object of class A in memory
- after second request: there're two objects of class A in memory!!!
- after third request: there're three objects of class A in memory!!!
- after Nth request: there're still three objects of class A in memory!!!
The complete log output will look like this: