ruby/test
Peter Zhu 10574857ce Fix memory leak in Regexp capture group when timeout
[Bug #20650]

The capture group allocates memory that is leaked when it times out.

For example:

    re = Regexp.new("^#{"(a*)" * 10_000}x$", timeout: 0.000001)
    str = "a" * 1000000 + "x"

    10.times do
      100.times do
        re =~ str
      rescue Regexp::TimeoutError
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    34688
    56416
    78288
    100368
    120784
    140704
    161904
    183568
    204320
    224800

After:

    16288
    16288
    16880
    16896
    16912
    16928
    16944
    17184
    17184
    17200
2024-07-25 09:23:49 -04:00
..
-ext- [PRISM] Refactor parser support into its own module 2024-07-18 21:15:54 -04:00
.excludes
.excludes-prism Revert pending `EVENT_RETURN` tests 2024-07-17 14:06:11 -04:00
benchmark
cgi
coverage [PRISM] Modify test_coverage to take prism into account 2024-04-26 12:25:45 -04:00
date [ruby/date] Remove the unintentional ability to parse `Symbol` 2024-02-21 16:04:52 +00:00
did_you_mean Do not include a backtick in error messages and backtraces 2024-02-15 18:42:31 +09:00
digest
dtrace
erb
error_highlight [ruby/error_highlight] Make test_COLON2_5 conditional again 2024-07-12 06:26:53 +00:00
etc
fiber Enumerator should use a non-blocking fiber, change `rb_fiber_new` to be non-blocking by default. (#10481) 2024-04-08 00:49:01 +12:00
fiddle [ruby/fiddle] Pick ruby/ruby changes for 2024-07-02 18:33:39 +09:00
fileutils
io [ruby/io-console] Load the built extension library in noctty tests 2024-04-10 09:10:50 +00:00
irb [ruby/irb] Clear ENV["XDG_CONFIG_HOME"] to avoid loading 2024-07-18 10:56:19 +00:00
json [flori/json] Make OpenStruct support as optional 2024-01-31 14:56:00 +09:00
lib [PRISM] Refactor parser support into its own module 2024-07-18 21:15:54 -04:00
logger [ruby/logger] Add reraise_write_errors keyword argument to Logger and LogDevice 2024-07-11 15:25:17 +00:00
mkmf Extend the timeout of test_try_ldflag_invalid_opt and test_try_cppflag_invalid_opt 2024-06-24 18:14:34 +09:00
monitor
net To avoid fd leak with fetch request for SSL server 2024-07-17 17:37:57 +09:00
objspace [Feature #20470] Split GC into gc_impl.c 2024-07-03 09:03:40 -04:00
open-uri Removed needless block arguments 2024-07-17 17:37:57 +09:00
openssl [ruby/openssl] x509attr: avoid using OpenSSL::ASN1 internals in #value= 2024-07-24 16:50:01 +00:00
optparse [ruby/optparse] Invoke pager for `--help` 2024-03-01 07:10:08 +00:00
ostruct
pathname
prism [Bug #20647] Disallow `return` directly within a singleton class 2024-07-24 14:44:32 +09:00
psych
rdoc Require space between hash/content in ATX heading (#1140) 2024-07-18 09:40:01 +09:00
reline [ruby/reline] Fix rendering bug of nomultiline prompt 2024-07-12 12:21:26 +00:00
resolv [ruby/resolv] Add an explicit with_udp_and_tcp helper to test_dns.rb 2024-03-31 23:57:00 +00:00
ripper [Bug #20649] Allow `nil` as 2nd argument of `assign_error` 2024-07-24 22:18:36 +09:00
ruby Fix memory leak in Regexp capture group when timeout 2024-07-25 09:23:49 -04:00
rubygems [rubygems/rubygems] Fix line comment issue for map 2024-07-19 03:03:16 +00:00
set
socket Revise 9ec342e07d 2024-02-26 13:12:05 +09:00
stringio [ruby/stringio] Remove special handling of chilled strings 2024-05-30 15:11:48 +00:00
strscan [ruby/strscan] Omit tests for `#scan_byte` and `#peek_byte` on 2024-03-27 12:17:01 +09:00
uri [ruby/uri] Also support URI::PATTERN with switch-back 2024-07-19 00:50:38 +00:00
win32 Test for win32/registry.rb 2024-05-03 14:47:18 +09:00
win32ole [ruby/win32ole] Test constants for the backward compatibility 2024-03-23 10:34:35 +00:00
yaml [ruby/yaml] Make PStore support as optional 2024-01-31 05:56:39 +00:00
zlib [ruby/zlib] Avoid allocating intermediary strings when read/readpartial are passed an outbuf 2024-05-14 21:44:34 +00:00
runner.rb
test_bundled_gems.rb bundled_gems.rb: Add a fast path 2024-07-22 10:33:07 +02:00
test_delegate.rb [ruby/delegate] test: remove needless mu_pp 2024-04-30 23:31:26 +00:00
test_extlibs.rb
test_find.rb
test_forwardable.rb [ruby/forwardable] Relax regexp for Ruby 3.3 or before 2024-02-16 02:12:08 +00:00
test_ipaddr.rb [ruby/ipaddr] Add IPAddr.cidr to return ip address in cidr notation 2024-04-18 10:27:19 +09:00
test_open3.rb
test_pp.rb [ruby/pp] Extract pp_hash_pair 2024-02-21 16:45:01 +00:00
test_prettyprint.rb
test_pstore.rb
test_pty.rb
test_rbconfig.rb
test_securerandom.rb
test_shellwords.rb
test_singleton.rb
test_tempfile.rb [ruby/tempfile] typofix 2024-07-08 06:18:57 +00:00
test_time.rb
test_timeout.rb Make test_nested_timeouts less flaky 2024-05-28 12:49:46 +09:00
test_tmpdir.rb
test_trick.rb Ensure test suite is compatible with --frozen-string-literal 2024-03-14 17:56:15 +01:00
test_tsort.rb
test_unicode_normalize.rb
test_weakref.rb