ruby_memcheck 2.3.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/lint.yml +0 -2
- data/.github/workflows/test.yml +2 -0
- data/.gitignore +0 -2
- data/.rubocop.yml +0 -1
- data/.ruby-version +1 -0
- data/Gemfile.lock +66 -0
- data/README.md +4 -0
- data/lib/ruby_memcheck/configuration.rb +17 -1
- data/lib/ruby_memcheck/stack.rb +26 -0
- data/lib/ruby_memcheck/version.rb +1 -1
- data/ruby_memcheck.gemspec +2 -2
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b355c60060a1d3a88b9bb7216eba3f2b0b286b084bcae72559447a3cd7c44cc
|
4
|
+
data.tar.gz: ff119d0a8850a483ad18cb7a7f05b34a0338b41782d2717e442be06ef22784b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a47edc485be9e7cfba605631576a69fc2a726be97b27b3e7aeb36ae65e18efaeba00ddc799bce147e40b20fcfa30f96cf19b595f4e6bd60265b1fe8d3eac3237
|
7
|
+
data.tar.gz: 3f58eee4a01327e67be1bf3d3b393841c955185cfdbf7c4da3759350c7397d0d5288988f1fc6b0724aca831315125f77da073ac4717b2ab6d6db8f08e28fc6c7
|
data/.github/workflows/lint.yml
CHANGED
data/.github/workflows/test.yml
CHANGED
@@ -10,6 +10,8 @@ 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 }
|
14
|
+
- { ruby: '3.4', allowed-failure: false }
|
13
15
|
- { ruby: ruby-head, allowed-failure: false }
|
14
16
|
name: ruby ${{ matrix.entry.ruby }}
|
15
17
|
steps:
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.4.1
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ruby_memcheck (3.0.0)
|
5
|
+
nokogiri
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.2)
|
11
|
+
json (2.9.1)
|
12
|
+
language_server-protocol (3.17.0.3)
|
13
|
+
mini_portile2 (2.8.8)
|
14
|
+
minitest (5.25.4)
|
15
|
+
minitest-parallel_fork (2.0.0)
|
16
|
+
minitest (>= 5.15.0)
|
17
|
+
nokogiri (1.17.2)
|
18
|
+
mini_portile2 (~> 2.8.2)
|
19
|
+
racc (~> 1.4)
|
20
|
+
parallel (1.26.3)
|
21
|
+
parser (3.3.6.0)
|
22
|
+
ast (~> 2.4.1)
|
23
|
+
racc
|
24
|
+
racc (1.8.1)
|
25
|
+
rainbow (3.1.1)
|
26
|
+
rake (13.2.1)
|
27
|
+
rake-compiler (1.2.8)
|
28
|
+
rake
|
29
|
+
regexp_parser (2.10.0)
|
30
|
+
rspec-core (3.13.2)
|
31
|
+
rspec-support (~> 3.13.0)
|
32
|
+
rspec-support (3.13.1)
|
33
|
+
rubocop (1.69.2)
|
34
|
+
json (~> 2.3)
|
35
|
+
language_server-protocol (>= 3.17.0)
|
36
|
+
parallel (~> 1.10)
|
37
|
+
parser (>= 3.3.0.2)
|
38
|
+
rainbow (>= 2.2.2, < 4.0)
|
39
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
40
|
+
rubocop-ast (>= 1.36.2, < 2.0)
|
41
|
+
ruby-progressbar (~> 1.7)
|
42
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
43
|
+
rubocop-ast (1.37.0)
|
44
|
+
parser (>= 3.3.1.0)
|
45
|
+
rubocop-shopify (2.15.1)
|
46
|
+
rubocop (~> 1.51)
|
47
|
+
ruby-progressbar (1.13.0)
|
48
|
+
unicode-display_width (3.1.3)
|
49
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
50
|
+
unicode-emoji (4.0.4)
|
51
|
+
|
52
|
+
PLATFORMS
|
53
|
+
ruby
|
54
|
+
|
55
|
+
DEPENDENCIES
|
56
|
+
minitest (~> 5.0)
|
57
|
+
minitest-parallel_fork (~> 2.0)
|
58
|
+
rake (~> 13.0)
|
59
|
+
rake-compiler (~> 1.1)
|
60
|
+
rspec-core
|
61
|
+
rubocop (~> 1.22)
|
62
|
+
rubocop-shopify (~> 2.3)
|
63
|
+
ruby_memcheck!
|
64
|
+
|
65
|
+
BUNDLED WITH
|
66
|
+
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
|
|
@@ -195,6 +196,9 @@ Let's celebrate wins from this gem! If this gem was useful for you, please share
|
|
195
196
|
- [`libxml2`](https://gitlab.gnome.org/GNOME/libxml2):
|
196
197
|
- Found 1 memory leak: [memory leak from \`xmlSchemaValidateStream\` in v2.11.x (#530)](https://gitlab.gnome.org/GNOME/libxml2/-/issues/530)
|
197
198
|
- Running in Nokogiri's CI pipeline: [#2868](https://github.com/sparklemotion/nokogiri/pull/2868)
|
199
|
+
- [`re2`](https://github.com/mudge/re2):
|
200
|
+
- Found 8 memory leaks: [#105](https://github.com/mudge/re2/pull/105)
|
201
|
+
- Running on CI: [#149](https://github.com/mudge/re2/pull/149)
|
198
202
|
|
199
203
|
## License
|
200
204
|
|
@@ -29,8 +29,10 @@ module RubyMemcheck
|
|
29
29
|
/\Arb_rescue/,
|
30
30
|
/\Arb_respond_to\z/,
|
31
31
|
/\Arb_thread_create\z/, # Threads are relased to a cache, so they may be reported as a leak
|
32
|
+
/\Arb_vm_exec\z/,
|
32
33
|
/\Arb_yield/,
|
33
34
|
].freeze
|
35
|
+
RUBY_FREE_AT_EXIT_SUPPORTED = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0")
|
34
36
|
|
35
37
|
attr_reader :binary_name
|
36
38
|
attr_reader :ruby
|
@@ -43,9 +45,11 @@ module RubyMemcheck
|
|
43
45
|
attr_reader :loaded_features_file
|
44
46
|
attr_reader :output_io
|
45
47
|
attr_reader :filter_all_errors
|
48
|
+
attr_reader :use_only_ruby_free_at_exit
|
46
49
|
|
47
50
|
alias_method :valgrind_generate_suppressions?, :valgrind_generate_suppressions
|
48
51
|
alias_method :filter_all_errors?, :filter_all_errors
|
52
|
+
alias_method :use_only_ruby_free_at_exit?, :use_only_ruby_free_at_exit
|
49
53
|
|
50
54
|
def initialize(
|
51
55
|
binary_name: nil,
|
@@ -57,7 +61,8 @@ module RubyMemcheck
|
|
57
61
|
skipped_ruby_functions: DEFAULT_SKIPPED_RUBY_FUNCTIONS,
|
58
62
|
temp_dir: Dir.mktmpdir,
|
59
63
|
output_io: $stderr,
|
60
|
-
filter_all_errors: false
|
64
|
+
filter_all_errors: false,
|
65
|
+
use_only_ruby_free_at_exit: RUBY_FREE_AT_EXIT_SUPPORTED
|
61
66
|
)
|
62
67
|
@binary_name = binary_name
|
63
68
|
@ruby = ruby
|
@@ -83,6 +88,8 @@ module RubyMemcheck
|
|
83
88
|
]
|
84
89
|
|
85
90
|
@loaded_features_file = Tempfile.create("", @temp_dir)
|
91
|
+
|
92
|
+
@use_only_ruby_free_at_exit = use_only_ruby_free_at_exit
|
86
93
|
end
|
87
94
|
|
88
95
|
def command(*args)
|
@@ -94,6 +101,15 @@ module RubyMemcheck
|
|
94
101
|
# ruby_init_stack (thread_pthread.c:871)
|
95
102
|
# main (main.c:48)
|
96
103
|
"ulimit -s unlimited && ",
|
104
|
+
# On some distros, and in some Docker containers, the number of file descriptors is set to a
|
105
|
+
# very high number like 1073741816 that valgrind >= 3.21.0 will error out on:
|
106
|
+
# --184100:0:libcfile Valgrind: FATAL: Private file creation failed.
|
107
|
+
# The current file descriptor limit is 1073741804.
|
108
|
+
# If you are running in Docker please consider
|
109
|
+
# lowering this limit with the shell built-in limit command.
|
110
|
+
# --184100:0:libcfile Exiting now.
|
111
|
+
# See https://bugs.kde.org/show_bug.cgi?id=465435 for background information.
|
112
|
+
"ulimit -n 8192 && ",
|
97
113
|
valgrind,
|
98
114
|
valgrind_options,
|
99
115
|
valgrind_suppression_files.map { |f| "--suppressions=#{f}" },
|
data/lib/ruby_memcheck/stack.rb
CHANGED
@@ -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|
|
data/ruby_memcheck.gemspec
CHANGED
@@ -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 =
|
14
|
+
spec.required_ruby_version = ">= 3.0.0"
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency("nokogiri")
|
28
28
|
|
29
29
|
spec.add_development_dependency("minitest", "~> 5.0")
|
30
|
-
spec.add_development_dependency("minitest-parallel_fork", "~>
|
30
|
+
spec.add_development_dependency("minitest-parallel_fork", "~> 2.0")
|
31
31
|
spec.add_development_dependency("rake", "~> 13.0")
|
32
32
|
spec.add_development_dependency("rake-compiler", "~> 1.1")
|
33
33
|
spec.add_development_dependency("rspec-core")
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_memcheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Zhu
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: nokogiri
|
@@ -44,14 +43,14 @@ dependencies:
|
|
44
43
|
requirements:
|
45
44
|
- - "~>"
|
46
45
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
46
|
+
version: '2.0'
|
48
47
|
type: :development
|
49
48
|
prerelease: false
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
51
50
|
requirements:
|
52
51
|
- - "~>"
|
53
52
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
53
|
+
version: '2.0'
|
55
54
|
- !ruby/object:Gem::Dependency
|
56
55
|
name: rake
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +121,6 @@ dependencies:
|
|
122
121
|
- - "~>"
|
123
122
|
- !ruby/object:Gem::Version
|
124
123
|
version: '2.3'
|
125
|
-
description:
|
126
124
|
email:
|
127
125
|
- peter@peterzhu.ca
|
128
126
|
executables:
|
@@ -130,12 +128,15 @@ executables:
|
|
130
128
|
extensions: []
|
131
129
|
extra_rdoc_files: []
|
132
130
|
files:
|
131
|
+
- ".github/dependabot.yml"
|
133
132
|
- ".github/workflows/cla.yml"
|
134
133
|
- ".github/workflows/lint.yml"
|
135
134
|
- ".github/workflows/test.yml"
|
136
135
|
- ".gitignore"
|
137
136
|
- ".rubocop.yml"
|
137
|
+
- ".ruby-version"
|
138
138
|
- Gemfile
|
139
|
+
- Gemfile.lock
|
139
140
|
- LICENSE.txt
|
140
141
|
- README.md
|
141
142
|
- Rakefile
|
@@ -159,7 +160,6 @@ licenses:
|
|
159
160
|
- MIT
|
160
161
|
metadata:
|
161
162
|
homepage_uri: https://github.com/Shopify/ruby_memcheck
|
162
|
-
post_install_message:
|
163
163
|
rdoc_options: []
|
164
164
|
require_paths:
|
165
165
|
- lib
|
@@ -167,15 +167,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
167
|
requirements:
|
168
168
|
- - ">="
|
169
169
|
- !ruby/object:Gem::Version
|
170
|
-
version:
|
170
|
+
version: 3.0.0
|
171
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
172
|
requirements:
|
173
173
|
- - ">="
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
|
-
rubygems_version: 3.
|
178
|
-
signing_key:
|
177
|
+
rubygems_version: 3.6.2
|
179
178
|
specification_version: 4
|
180
179
|
summary: Use Valgrind memcheck without going crazy
|
181
180
|
test_files: []
|