1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-10-24 15:52:35 +02:00
parent 1388257d7a
commit 342fbae83c
2 changed files with 16 additions and 2 deletions

View file

@ -36,6 +36,7 @@ class LeakChecker
@thread_info = find_threads
@env_info = find_env
@argv_info = find_argv
@globals_info = find_globals
@encoding_info = find_encodings
end
@ -48,9 +49,10 @@ class LeakChecker
check_process_leak
check_env
check_argv
check_globals
check_encodings
check_tracepoints
GC.start if !@leaks.empty?
GC.start unless @leaks.empty?
@leaks.empty?
end
@ -244,6 +246,19 @@ class LeakChecker
end
end
def find_globals
{ verbose: $VERBOSE, debug: $DEBUG }
end
def check_globals
old_globals = @globals_info
new_globals = find_globals
if new_globals != old_globals
leak "Globals changed: #{old_globals.inspect} to #{new_globals.inspect}"
@globals_info = new_globals
end
end
def find_encodings
[Encoding.default_internal, Encoding.default_external]
end

View file

@ -45,7 +45,6 @@ if Object.const_defined?(:Warning) and Warning.respond_to?(:warn)
when /\/(argf|io|stringio)\/.+(ARGF|IO)#(lines|chars|bytes|codepoints) is deprecated/
when /Thread\.exclusive is deprecated.+\n.+thread\/exclusive_spec\.rb/
when /hash\/shared\/index\.rb:\d+: warning: Hash#index is deprecated; use Hash#key/
when /env\/shared\/key\.rb:\d+: warning: ENV\.index is deprecated; use ENV\.key/
when /exponent(_spec)?\.rb:\d+: warning: in a\*\*b, b may be too big/
when /enumerator\/(new_spec|initialize_spec)\.rb:\d+: warning: Enumerator\.new without a block is deprecated/
when /Pattern matching is experimental, and the behavior may change in future versions of Ruby!/