ruby_memcheck 2.2.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d995f1c581f36353698de1ed410eb6c7728ff11313b59992f7c935f98a73e960
4
- data.tar.gz: f499de55cd5d482a60cd33cb393c1cac415374188f19c97ae42545a884b6bb5d
3
+ metadata.gz: f2a9e15e7960c9c0a8094be720d2ad74fa3104eecb91fba0e9e0e3618c882c08
4
+ data.tar.gz: 836ed52bab1fd322d7eb0fac48159560a68266b554a5f55f865c3d62f25564f0
5
5
  SHA512:
6
- metadata.gz: 61add3f638205732ea2e17dac9b970b18dcaa9177543321d6f6cf9f0fcdb2c9498f631e9d8cb40e1626f043e68864fe7995356c63d130c854b56554c9c5cd5c1
7
- data.tar.gz: f089633851cf9d95ffc383dce6b8f62abb28f80adcf10f6d049fd0446cbca2202632ab4439e1bf5133de62d395552ae426a8f41dda59c7199ca8cecd4d33a55b
6
+ metadata.gz: 29de912221a25bbda4d389c72b352d5cbb24518068e127a7583e9bb08fe512a18a63b127066121f7b0f1de2d305cc8b225531993b32dc5e2ea6238aca0d78290
7
+ data.tar.gz: f1d492816966602826019d6980617399cc6199ab4f0f69ab4841a6112468def380f799f642c2d1757d403003e23dc38499882fdc5da7026ec0ea7671b95ae6a6
@@ -6,7 +6,5 @@ jobs:
6
6
  steps:
7
7
  - uses: actions/checkout@v2
8
8
  - uses: ruby/setup-ruby@v1
9
- with:
10
- ruby-version: '3.0'
11
9
  - run: bundle install --jobs=3 --retry=3 --path=vendor/bundle
12
10
  - run: bundle exec rubocop
@@ -10,6 +10,7 @@ jobs:
10
10
  - { ruby: '3.0', allowed-failure: false }
11
11
  - { ruby: '3.1', allowed-failure: false }
12
12
  - { ruby: '3.2', allowed-failure: false }
13
+ - { ruby: '3.3', allowed-failure: false }
13
14
  - { ruby: ruby-head, allowed-failure: false }
14
15
  name: ruby ${{ matrix.entry.ruby }}
15
16
  steps:
data/.gitignore CHANGED
@@ -1,5 +1,3 @@
1
- Gemfile.lock
2
-
3
1
  /.bundle/
4
2
  /.yardoc
5
3
  /_yardoc/
data/.rubocop.yml CHANGED
@@ -2,7 +2,6 @@ inherit_gem:
2
2
  rubocop-shopify: rubocop.yml
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 2.6
6
5
  SuggestExtensions: false
7
6
 
8
7
  Style/GlobalVars:
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.1
data/Gemfile.lock ADDED
@@ -0,0 +1,68 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby_memcheck (2.3.0)
5
+ nokogiri
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ json (2.7.1)
12
+ language_server-protocol (3.17.0.3)
13
+ mini_portile2 (2.8.5)
14
+ minitest (5.22.3)
15
+ minitest-parallel_fork (1.3.1)
16
+ minitest (>= 5.15.0)
17
+ nokogiri (1.16.3)
18
+ mini_portile2 (~> 2.8.2)
19
+ racc (~> 1.4)
20
+ nokogiri (1.16.3-arm64-darwin)
21
+ racc (~> 1.4)
22
+ parallel (1.24.0)
23
+ parser (3.3.0.5)
24
+ ast (~> 2.4.1)
25
+ racc
26
+ racc (1.7.3)
27
+ rainbow (3.1.1)
28
+ rake (13.1.0)
29
+ rake-compiler (1.2.7)
30
+ rake
31
+ regexp_parser (2.9.0)
32
+ rexml (3.2.6)
33
+ rspec-core (3.13.0)
34
+ rspec-support (~> 3.13.0)
35
+ rspec-support (3.13.1)
36
+ rubocop (1.62.1)
37
+ json (~> 2.3)
38
+ language_server-protocol (>= 3.17.0)
39
+ parallel (~> 1.10)
40
+ parser (>= 3.3.0.2)
41
+ rainbow (>= 2.2.2, < 4.0)
42
+ regexp_parser (>= 1.8, < 3.0)
43
+ rexml (>= 3.2.5, < 4.0)
44
+ rubocop-ast (>= 1.31.1, < 2.0)
45
+ ruby-progressbar (~> 1.7)
46
+ unicode-display_width (>= 2.4.0, < 3.0)
47
+ rubocop-ast (1.31.2)
48
+ parser (>= 3.3.0.4)
49
+ rubocop-shopify (2.15.1)
50
+ rubocop (~> 1.51)
51
+ ruby-progressbar (1.13.0)
52
+ unicode-display_width (2.5.0)
53
+
54
+ PLATFORMS
55
+ ruby
56
+
57
+ DEPENDENCIES
58
+ minitest (~> 5.0)
59
+ minitest-parallel_fork (~> 1.2)
60
+ rake (~> 13.0)
61
+ rake-compiler (~> 1.1)
62
+ rspec-core
63
+ rubocop (~> 1.22)
64
+ rubocop-shopify (~> 2.3)
65
+ ruby_memcheck!
66
+
67
+ BUNDLED WITH
68
+ 2.4.10
data/README.md CHANGED
@@ -163,6 +163,7 @@ If you want to override any of the default configurations you can call `RubyMemc
163
163
  - `temp_dir`: Optional. The directory to store temporary files. It defaults to a temporary directory. This is present for development debugging, so you shouldn't have to use it.
164
164
  - `output_io`: Optional. The `IO` object to output Valgrind errors to. Defaults to standard error.
165
165
  - `filter_all_errors`: Optional. Whether to filter all kinds of Valgrind errors (not just memory leaks). This feature should only be used if you're encountering a large number of illegal memory accesses coming from Ruby. If you need to use this feature, you may have found a bug inside of Ruby. Consider reporting it to the [Ruby bug tracker](https://bugs.ruby-lang.org/projects/ruby-master/issues/new). Defaults to `false`.
166
+ - `use_only_ruby_free_at_exit`: Optional. Use only the [`RUBY_FREE_AT_EXIT`](https://bugs.ruby-lang.org/issues/19993) feature introduced in Ruby 3.3 and disables most of the heuristics inside of ruby_memcheck. Disable this if you want to use the original heuristics. Defaults to `true` for Ruby 3.4 and later, `false` otherwise. Note: while `RUBY_FREE_AT_EXIT` was introduced in Ruby 3.3, there are bugs which prevents it from working well, so it is only enabled by default for Ruby 3.4 and later.
166
167
 
167
168
  ## Suppression files
168
169
 
@@ -31,6 +31,7 @@ module RubyMemcheck
31
31
  /\Arb_thread_create\z/, # Threads are relased to a cache, so they may be reported as a leak
32
32
  /\Arb_yield/,
33
33
  ].freeze
34
+ RUBY_FREE_AT_EXIT_SUPPORTED = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0")
34
35
 
35
36
  attr_reader :binary_name
36
37
  attr_reader :ruby
@@ -43,9 +44,11 @@ module RubyMemcheck
43
44
  attr_reader :loaded_features_file
44
45
  attr_reader :output_io
45
46
  attr_reader :filter_all_errors
47
+ attr_reader :use_only_ruby_free_at_exit
46
48
 
47
49
  alias_method :valgrind_generate_suppressions?, :valgrind_generate_suppressions
48
50
  alias_method :filter_all_errors?, :filter_all_errors
51
+ alias_method :use_only_ruby_free_at_exit?, :use_only_ruby_free_at_exit
49
52
 
50
53
  def initialize(
51
54
  binary_name: nil,
@@ -57,7 +60,8 @@ module RubyMemcheck
57
60
  skipped_ruby_functions: DEFAULT_SKIPPED_RUBY_FUNCTIONS,
58
61
  temp_dir: Dir.mktmpdir,
59
62
  output_io: $stderr,
60
- filter_all_errors: false
63
+ filter_all_errors: false,
64
+ use_only_ruby_free_at_exit: RUBY_FREE_AT_EXIT_SUPPORTED
61
65
  )
62
66
  @binary_name = binary_name
63
67
  @ruby = ruby
@@ -83,6 +87,8 @@ module RubyMemcheck
83
87
  ]
84
88
 
85
89
  @loaded_features_file = Tempfile.create("", @temp_dir)
90
+
91
+ @use_only_ruby_free_at_exit = use_only_ruby_free_at_exit
86
92
  end
87
93
 
88
94
  def command(*args)
@@ -10,6 +10,32 @@ module RubyMemcheck
10
10
  end
11
11
 
12
12
  def skip?
13
+ if @configuration.use_only_ruby_free_at_exit?
14
+ skip_using_ruby_free_at_exit?
15
+ else
16
+ skip_using_original_heuristics?
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def skip_using_ruby_free_at_exit?
23
+ if configuration.binary_name.nil?
24
+ false
25
+ else
26
+ in_binary = false
27
+
28
+ frames.each do |frame|
29
+ if frame.in_binary?
30
+ in_binary = true
31
+ end
32
+ end
33
+
34
+ !in_binary
35
+ end
36
+ end
37
+
38
+ def skip_using_original_heuristics?
13
39
  in_binary = false
14
40
 
15
41
  frames.each do |frame|
@@ -21,6 +21,7 @@ module RubyMemcheck
21
21
  def setup
22
22
  ENV["RUBY_MEMCHECK_LOADED_FEATURES_FILE"] = File.expand_path(configuration.loaded_features_file)
23
23
  ENV["RUBY_MEMCHECK_RUNNING"] = "1"
24
+ ENV["RUBY_FREE_AT_EXIT"] = "1"
24
25
  end
25
26
 
26
27
  def report_valgrind_errors
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyMemcheck
4
- VERSION = "2.2.1"
4
+ VERSION = "3.0.0"
5
5
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = "Use Valgrind memcheck without going crazy"
12
12
  spec.homepage = "https://github.com/Shopify/ruby_memcheck"
13
13
  spec.license = "MIT"
14
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+ spec.required_ruby_version = ">= 3.0.0"
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
17
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_memcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Zhu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-09 00:00:00.000000000 Z
11
+ date: 2024-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -135,7 +135,9 @@ files:
135
135
  - ".github/workflows/test.yml"
136
136
  - ".gitignore"
137
137
  - ".rubocop.yml"
138
+ - ".ruby-version"
138
139
  - Gemfile
140
+ - Gemfile.lock
139
141
  - LICENSE.txt
140
142
  - README.md
141
143
  - Rakefile
@@ -167,14 +169,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
169
  requirements:
168
170
  - - ">="
169
171
  - !ruby/object:Gem::Version
170
- version: 2.3.0
172
+ version: 3.0.0
171
173
  required_rubygems_version: !ruby/object:Gem::Requirement
172
174
  requirements:
173
175
  - - ">="
174
176
  - !ruby/object:Gem::Version
175
177
  version: '0'
176
178
  requirements: []
177
- rubygems_version: 3.4.10
179
+ rubygems_version: 3.5.9
178
180
  signing_key:
179
181
  specification_version: 4
180
182
  summary: Use Valgrind memcheck without going crazy