diff options
author | Jamis Buck <jamis@37signals.com> | 2005-10-15 18:21:27 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2005-10-15 18:21:27 +0000 |
commit | e7f61eab56d8a628cc605e5fa1e9055c4df852c7 (patch) | |
tree | 20f078f0b61263c5bd209c4f97aed6c652a041de /activerecord/test | |
parent | d72201e43801994ade896a9706f0960589e3e8a7 (diff) | |
download | rails-e7f61eab56d8a628cc605e5fa1e9055c4df852c7.tar.gz rails-e7f61eab56d8a628cc605e5fa1e9055c4df852c7.tar.bz2 rails-e7f61eab56d8a628cc605e5fa1e9055c4df852c7.zip |
squash the memleak in dev mode finally (fingers crossed, here)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2620 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/base_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 9b5ce8a8ce..ae443c5329 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -1024,6 +1024,25 @@ class BasicsTest < Test::Unit::TestCase assert_nothing_raised { Category.new.send(:interpolate_sql, 'foo bar} baz') } end + def test_dev_mode_memory_leak + counts = [] + 2.times do + require_dependency 'fixtures/company' + Firm.find(:first) + Dependencies.clear + ActiveRecord::Base.reset_subclasses + Dependencies.remove_subclasses_for(ActiveRecord::Base) + + GC.start + + count = 0 + ObjectSpace.each_object(Proc) { count += 1 } + counts << count + end + assert counts.last <= counts.first, + "expected last count (#{counts.last}) to be <= first count (#{counts.first})" + end + private def assert_readers(model, exceptions) |