提交 c712b082 编写于 作者: I Iuri Gagnidze

Added test to ensure that DescendantsTracker does not leak memory on singleton classes

上级 3c2c1a46
......@@ -4,4 +4,14 @@
class DescendantsTrackerWithoutAutoloadingTest < ActiveSupport::TestCase
include DescendantsTrackerTestCases
def test_clear_without_autoloaded_singleton_parent
mark_as_autoloaded do
parent_instance = Parent.new
parent_instance.singleton_class.descendants #adds singleton class in @@direct_descendants
ActiveSupport::DescendantsTracker.clear #clear is supposed to remove singleton class keys so GC can remove them.
assert !ActiveSupport::DescendantsTracker.class_variable_get(:@@direct_descendants).keys.include?(parent_instance.singleton_class)
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册