diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-30 06:11:26 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-30 06:11:26 +0000 |
commit | 7e1d002673777bb1240e27949a853a8f287d1f56 (patch) | |
tree | de22db895d036c0729d61eb8ace57d2a53859428 /activesupport/test | |
parent | a90598b4581987297e425914096d6bf134957d17 (diff) | |
download | rails-7e1d002673777bb1240e27949a853a8f287d1f56.tar.gz rails-7e1d002673777bb1240e27949a853a8f287d1f56.tar.bz2 rails-7e1d002673777bb1240e27949a853a8f287d1f56.zip |
Fixed memory leak with Object#remove_subclasses_of, which inflicted a Rails application running in development mode with a ~20KB leak per request #1289 [c.r.mcgrath@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1569 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/object_and_class_ext_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb index a0a6243480..cf75159575 100644 --- a/activesupport/test/core_ext/object_and_class_ext_test.rb +++ b/activesupport/test/core_ext/object_and_class_ext_test.rb @@ -5,6 +5,13 @@ class ClassA; end class ClassB < ClassA; end class ClassC < ClassB; end class ClassD < ClassA; end +class RemoveSubsTestClass; end +class RemoveSubsBaseClass + def self.add_ivar + @ivar = RemoveSubsTestClass.new + end +end +class RemoveSubsSubClass < RemoveSubsBaseClass; end class ClassExtTest < Test::Unit::TestCase def test_methods @@ -30,4 +37,15 @@ class ObjectTests < Test::Unit::TestCase suppress(LoadError, ArgumentError) { raise LoadError } suppress(LoadError, ArgumentError) { raise ArgumentError } end + + def test_remove_subclasses_of_unsets_ivars + r = RemoveSubsSubClass.new + RemoveSubsSubClass.add_ivar + RemoveSubsBaseClass.remove_subclasses + + GC.start + ObjectSpace.each_object do |o| + flunk("ObjectSpace still contains RemoveSubsTestClass") if o.class == RemoveSubsTestClass + end + end end
\ No newline at end of file |