1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/connection_adapters
Jon Leighton 68e4442ec7 Fix memory leak in development mode
Keying these hashes by klass causes reloadable classes to never get
freed. Thanks to @thedarkone for pointing this out in
the comments on 221571beb6.

This doesn't seem to make a massive difference to performance.

Benchmark
---------

require 'active_record'
require 'benchmark/ips'

class Post < ActiveRecord::Base
  establish_connection adapter: 'sqlite3', database: ':memory:'
end

GC.disable

Benchmark.ips(20) do |r|
  r.report { Post.connection }
end

Before
------

Calculating -------------------------------------
                          5632 i/100ms
-------------------------------------------------
                       218671.0 (±1.9%) i/s -    4364800 in  19.969401s

After
-----

Calculating -------------------------------------
                          8743 i/100ms
-------------------------------------------------
                       206525.9 (±17.8%) i/s -    4039266 in  19.992590s
2012-11-30 11:50:11 +00:00
..
abstract_adapter_test.rb Use "refute" instead of "assert !" 2012-11-27 21:15:53 -02:00
connection_handler_test.rb Fix memory leak in development mode 2012-11-30 11:50:11 +00:00
connection_specification_test.rb connection specification will deep copy the config 2011-12-30 15:35:21 -08:00
quoting_test.rb Allow to run connection_adapters/quoting_test.rb independently 2012-05-09 17:08:36 -07:00
schema_cache_test.rb Add support schema cache dump and load. 2012-03-01 00:52:04 +09:00