From 64634ce61a6098fd0983252c094b81a5ec4aa5a5 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Wed, 11 May 2016 13:36:32 +0900 Subject: [ci skip] Update documents of `ConnectionHandler` Follow up of #24844. The key of `@owner_to_pool` was changed from `klass.name` to `spec.name`. By this change "memory leaks in development mode" will not happen, bacause the equality of string is not changed by reloading of model files. --- .../lib/active_record/connection_adapters/abstract/connection_pool.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 1bea16ebcc..f3abd01290 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -826,9 +826,7 @@ module ActiveRecord # in order to lookup the correct connection pool. class ConnectionHandler def initialize - # These caches are keyed by klass.name, NOT klass. Keying them by klass - # alone would lead to memory leaks in development mode as all previous - # instances of the class would stay in memory. + # These caches are keyed by spec.name (ConnectionSpecification#name). @owner_to_pool = Concurrent::Map.new(:initial_capacity => 2) do |h,k| h[k] = Concurrent::Map.new(:initial_capacity => 2) end -- cgit v1.2.3