summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-31 17:46:51 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-31 17:46:51 +0000
commitef76e3cfb6710a3cb212f0a4d1319d0f3ac9926c (patch)
tree9cd1be0798fb330545c8648aadfc3b6f866031a3 /test
parentc7c1f371a4f2e96393fe5257637d8ad154511465 (diff)
downloadruby-ef76e3cfb6710a3cb212f0a4d1319d0f3ac9926c.tar.gz
Add IMEMO type to heap dump output.
IMEMO objects have many types. Without this change, we cannot see what types of IMEMO objects are being used when dumping the heap. Adding the type to the IMEMO object will allow us to gather statistics about IMEMO objects being used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/objspace/test_objspace.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb
index 7f8f247d9c..74e0ef9a50 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -277,6 +277,23 @@ class TestObjSpace < Test::Unit::TestCase
assert_match /"value":"foobar\h+"/, dump
end
+ def test_dump_includes_imemo_type
+ assert_in_out_err(%w[-robjspace], "#{<<-"begin;"}\n#{<<-'end;'}") do |output, error|
+ begin;
+ def dump_my_heap_please
+ ObjectSpace.dump_all(output: :stdout)
+ end
+
+ dump_my_heap_please
+ end;
+ heap = output.find_all { |l|
+ obj = JSON.parse(l)
+ obj['type'] == "IMEMO" && obj['imemo_type']
+ }
+ assert_operator heap.length, :>, 0
+ end
+ end
+
def test_dump_all_full
assert_in_out_err(%w[-robjspace], "#{<<-"begin;"}\n#{<<-'end;'}") do |output, error|
begin;