From a03b72e85011b71e031447b9c8c917e6f2c08c81 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 7 Jan 2023 21:51:14 +0000 Subject: drop heap page support for Ruby <= 3.0 Ruby 3.1 uses mmap, nowadays, and I don't think it's worth the effort to suport it since mmap and munmap don't require the symmetry *memalign + free do. --- test/test_mwrap.rb | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'test/test_mwrap.rb') diff --git a/test/test_mwrap.rb b/test/test_mwrap.rb index eaa65cb..6522167 100644 --- a/test/test_mwrap.rb +++ b/test/test_mwrap.rb @@ -59,13 +59,6 @@ class TestMwrap < Test::Unit::TestCase res = system(env, *cmd) assert res, $?.inspect assert_match(/\b1\d{4}\s+[1-9]\d*\s+-e:1$/, tmp.read) - - tmp.rewind - tmp.truncate(0) - env['MWRAP'] = "dump_path:#{tmp.path},dump_heap:5" - res = system(env, *cmd) - assert res, $?.inspect - assert_match %r{lifespan_stddev}, tmp.read end end @@ -295,35 +288,4 @@ class TestMwrap < Test::Unit::TestCase abort 'freed more than allocated' end; end - - def test_heap_page_body - assert_separately(+"#{<<~"begin;"}\n#{<<~'end;'}") - begin; - require 'mwrap' - require 'rubygems' # use up some memory - ap = GC.stat(:heap_allocated_pages) - h = {} - nr = 0 - Mwrap::HeapPageBody.each do |addr, gen| - nr += 1 - gen <= GC.count && gen >= 0 or abort "bad generation: #{gen}" - (0 == (addr & 16383)) or abort "addr not aligned: #{'%x' % addr}" - end - if RUBY_VERSION.to_f < 3.1 # 3.1+ uses mmap on platforms we care about - nr == ap or abort "HeapPageBody.each missed page #{nr} != #{ap}" - end - 10.times { (1..20000).to_a.map(&:to_s) } - 3.times { GC.start } - Mwrap::HeapPageBody.stat(h) - Integer === h[:lifespan_max] or abort 'lifespan_max not recorded' - Integer === h[:lifespan_min] or abort 'lifespan_min not recorded' - Float === h[:lifespan_mean] or abort 'lifespan_mean not recorded' - 3.times { GC.start } - 10.times { (1..20000).to_a.map(&:to_s) } - Mwrap::HeapPageBody.stat(h) - h[:deathspan_min] <= h[:deathspan_max] or - abort 'wrong min/max deathtime' - Float === h[:deathspan_mean] or abort 'deathspan_mean not recorded' - end; - end end -- cgit v1.2.3-24-ge0c7