aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-11-17 22:29:02 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-11-17 22:29:02 +0000
commitf92d6a07d0d01226fb80c82608d332843c01f2d6 (patch)
tree85cf921498269163d2e9911122d5a97a0284fe47
parent44e6aa7e19928f401e8728ddc2f4d7f6e3d6e105 (diff)
downloadrails-f92d6a07d0d01226fb80c82608d332843c01f2d6.tar.gz
rails-f92d6a07d0d01226fb80c82608d332843c01f2d6.tar.bz2
rails-f92d6a07d0d01226fb80c82608d332843c01f2d6.zip
Reuse named route helper module between Routing reloads to prevent memory leaks.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5548 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/routing.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 1b0f6e55b3..dcfb88f37f 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Reuse named route helper module between Routing reloads. Use remove_method to delete named route methods after each load. Since the module is never collected, this fixes a significant memory leak. [Nicholas Seckar]
+
* ActionView::Base.erb_variable accessor names the buffer variable used to render templates. Defaults to _erbout; use _buf for erubis. [Rick Olson]
* assert_select_rjs :remove. [Dylan Egan]
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb
index 35eec734d3..3c53acc164 100644
--- a/actionpack/lib/action_controller/routing.rb
+++ b/actionpack/lib/action_controller/routing.rb
@@ -996,7 +996,11 @@ module ActionController
def clear!
@routes = {}
@helpers = []
- @module = Module.new
+
+ @module ||= Module.new
+ @module.instance_methods.each do |selector|
+ @module.send :remove_method, selector
+ end
end
def add(name, route)