ruby-changes:34708
From: ngoto <ko1@a...>
Date: Sat, 12 Jul 2014 01:32:21 +0900 (JST)
Subject: [ruby-changes:34708] ngoto:r46791 (trunk): * test/ruby/envutil.rb (assert_no_memory_leak): On Solaris 9 or later,
ngoto 2014-07-12 01:32:07 +0900 (Sat, 12 Jul 2014) New Revision: 46791 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46791 Log: * test/ruby/envutil.rb (assert_no_memory_leak): On Solaris 9 or later, if possible, execute child ruby with environment variables LD_PRELOAD=libumem.so UMEM_OPTIONS="backend=mmap". With these variables, freed memory is immediately returned to the OS. [Bug #10020] [ruby-dev:48391] Modified files: trunk/ChangeLog trunk/test/ruby/envutil.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 46790) +++ ChangeLog (revision 46791) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Jul 12 01:13:45 2014 Naohisa Goto <ngotogenome@g...> + + * test/ruby/envutil.rb (assert_no_memory_leak): On Solaris 9 or later, + if possible, execute child ruby with environment variables + LD_PRELOAD=libumem.so UMEM_OPTIONS="backend=mmap". With these + variables, freed memory is immediately returned to the OS. + [Bug #10020] [ruby-dev:48391] + Fri Jul 11 20:49:10 2014 Masaki Suketa <masaki.suketa@n...> * ext/win32ole/win32ole.c: add WIN32OLE_RECORD class to support Index: test/ruby/envutil.rb =================================================================== --- test/ruby/envutil.rb (revision 46790) +++ test/ruby/envutil.rb (revision 46791) @@ -408,6 +408,29 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/envutil.rb#L408 assert_warning(*args) {$VERBOSE = false; yield} end + case RUBY_PLATFORM + when /solaris2\.(?:9|[1-9][0-9])/i # Solaris 9, 10, 11,... + bits = [nil].pack('p').size == 8 ? 64 : 32 + if ENV['LD_PRELOAD'].to_s.empty? && + ENV["LD_PRELOAD_#{bits}"].to_s.empty? && + (ENV['UMEM_OPTIONS'].to_s.empty? || + ENV['UMEM_OPTIONS'] == 'backend=mmap') then + envs = { + 'LD_PRELOAD' => 'libumem.so', + 'UMEM_OPTIONS' => 'backend=mmap' + } + args = [ + envs, + "--disable=gems", + "-v", "-", + ] + _, err, status = EnvUtil.invoke_ruby(args, "exit(0)", true, true) + if status.exitstatus == 0 && err.to_s.empty? then + NO_MEMORY_LEAK_ENVS = envs + end + end + end #case RUBY_PLATFORM + def assert_no_memory_leak(args, prepare, code, message=nil, limit: 1.5, rss: false, **opt) require_relative 'memory_status' token = "\e[7;1m#{$$.to_s}:#{Time.now.strftime('%s.%L')}:#{rand(0x10000).to_s(16)}:\e[m" @@ -420,6 +443,11 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/envutil.rb#L443 *args, "-v", "-", ] + if defined? NO_MEMORY_LEAK_ENVS then + envs ||= {} + newenvs = envs.merge(NO_MEMORY_LEAK_ENVS) { |_, _, _| break } + envs = newenvs if newenvs + end args.unshift(envs) if envs cmd = [ 'END {STDERR.puts '"#{token_dump}"'"FINAL=#{Memory::Status.new}"}', -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/