diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-03-09 04:17:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-03-09 04:17:38 +0000 |
commit | e20cd8ee490537127fa07e22991bdc22402953e4 (patch) | |
tree | 7ec660abe3ce50097b9e3293827c2b58d1a45c1f /test/ruby/memory_status.rb | |
parent | 68649699670a4c69fa198f98a4215b3eb5135284 (diff) | |
download | ruby-e20cd8ee490537127fa07e22991bdc22402953e4.tar.gz |
test/ruby/envutil.rb: compare RSS to check memory leak
* test/ruby/envutil.rb (Test::Test#assert_no_memory_leak): compare
also RSS if available.
* test/ruby/memory_status.rb (Memory::Status.parse): read string
form of an instance.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/memory_status.rb')
-rw-r--r-- | test/ruby/memory_status.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/ruby/memory_status.rb b/test/ruby/memory_status.rb index cb2e9e094c..bfbfbd6e88 100644 --- a/test/ruby/memory_status.rb +++ b/test/ruby/memory_status.rb @@ -1,5 +1,3 @@ -require_relative "envutil" - module Memory keys = [] vals = [] @@ -110,5 +108,20 @@ module Memory def initialize _update end + + def to_s + status = each_pair.map {|n,v| + "#{n}:#{v}" + } + "{#{status.join(",")}}" + end + + def self.parse(str) + status = allocate + str.scan(/(?:\A\{|\G,)(#{members.join('|')}):(\d+)(?=,|\}\z)/) do + status[$1] = $2.to_i + end + status + end end end |