ruby_memcheck 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/ruby_memcheck/configuration.rb +15 -6
- data/lib/ruby_memcheck/version.rb +1 -1
- data/suppressions/ruby.supp +21 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cd707ffa4ebdb25945d2d2654659a38c2272a0e73678d9c9f58e655e19b3cc6
|
4
|
+
data.tar.gz: df247c2a1e77374ad3c9521b1a3f2554c443fa80e33d50cd948727821a3267d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b4c337a38ad04be648365f4de828187524f11f67699aaa187182d906e4dbf922d84767003e4bab79572c0b3c41fe908c2bb23b1029b1d49360a9c399df5010f
|
7
|
+
data.tar.gz: 3c73f128a88b0eabce497b0ebb464166ccc541dbf5ec0e03b1951d8e1569abd6123a48a454b6a2e9b808c95770ea922b6e027db8c2be2a458d5f0b53f3cb74bc
|
data/README.md
CHANGED
@@ -109,13 +109,13 @@ The easiest way to use this gem is to use it on your test suite (minitest or RSp
|
|
109
109
|
For example, if your Rakefile looked like this before:
|
110
110
|
|
111
111
|
```ruby
|
112
|
-
|
112
|
+
RSpec::Core::RakeTask.new(spec: :compile)
|
113
113
|
```
|
114
114
|
|
115
115
|
You can change it to look like this:
|
116
116
|
|
117
117
|
```ruby
|
118
|
-
|
118
|
+
RSpec::Core::RakeTask.new(spec: :compile)
|
119
119
|
namespace :spec do
|
120
120
|
RubyMemcheck::RSpec::RakeTask.new(valgrind: :compile)
|
121
121
|
end
|
@@ -156,7 +156,7 @@ When you run `RubyMemcheck.config`, you are creating a default `RubyMemcheck::Co
|
|
156
156
|
|
157
157
|
If you find false positives in the output, you can create suppression files in a `suppressions` directory in the root directory of your gem. In this directory, you can create [Valgrind suppression files](https://wiki.wxwidgets.org/Valgrind_Suppression_File_Howto).
|
158
158
|
|
159
|
-
The most basic suppression file is `
|
159
|
+
The most basic suppression file is `ruby.supp`. If you want some suppressions for only specific versions of Ruby, you can add the Ruby version to the filename. For example, `ruby-3.supp` will suppress for any Rubies with a major version of 3 (e.g. 3.0.0, 3.1.1, etc.), while suppression file `ruby-3.1.supp` will only be used for Ruby with a major and minor version of 3.1 (e.g. 3.1.0, 3.1.1, etc.).
|
160
160
|
|
161
161
|
## Success stories
|
162
162
|
|
@@ -29,11 +29,9 @@ module RubyMemcheck
|
|
29
29
|
/\Arb_respond_to\z/,
|
30
30
|
/\Arb_thread_create\z/, # Threads are relased to a cache, so they may be reported as a leak
|
31
31
|
/\Arb_yield/,
|
32
|
-
/\Astack_chunk_alloc/, # Remove this after Ruby 2.7.7, 3.0.5, 3.1.3 are relased
|
33
|
-
# See: https://github.com/Shopify/ruby_memcheck/issues/6
|
34
32
|
].freeze
|
35
33
|
|
36
|
-
attr_reader :binary_name, :ruby, :valgrind, :valgrind_options, :
|
34
|
+
attr_reader :binary_name, :ruby, :valgrind, :valgrind_options, :valgrind_suppression_files,
|
37
35
|
:valgrind_generate_suppressions, :skipped_ruby_functions, :valgrind_xml_dir, :output_io
|
38
36
|
alias_method :valgrind_generate_suppressions?, :valgrind_generate_suppressions
|
39
37
|
|
@@ -52,7 +50,9 @@ module RubyMemcheck
|
|
52
50
|
@ruby = ruby
|
53
51
|
@valgrind = valgrind
|
54
52
|
@valgrind_options = valgrind_options
|
55
|
-
@
|
53
|
+
@valgrind_suppression_files =
|
54
|
+
get_valgrind_suppression_files(File.join(__dir__, "../../suppressions")) +
|
55
|
+
get_valgrind_suppression_files(valgrind_suppressions_dir)
|
56
56
|
@valgrind_generate_suppressions = valgrind_generate_suppressions
|
57
57
|
@skipped_ruby_functions = skipped_ruby_functions
|
58
58
|
@output_io = output_io
|
@@ -82,7 +82,7 @@ module RubyMemcheck
|
|
82
82
|
"ulimit -s unlimited && ",
|
83
83
|
valgrind,
|
84
84
|
valgrind_options,
|
85
|
-
|
85
|
+
valgrind_suppression_files.map { |f| "--suppressions=#{f}" },
|
86
86
|
valgrind_generate_suppressions ? "--gen-suppressions=all" : "",
|
87
87
|
ruby,
|
88
88
|
args,
|
@@ -92,13 +92,22 @@ module RubyMemcheck
|
|
92
92
|
private
|
93
93
|
|
94
94
|
def get_valgrind_suppression_files(dir)
|
95
|
+
dir = File.expand_path(dir)
|
96
|
+
|
95
97
|
full_ruby_version = "#{RUBY_ENGINE}-#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"
|
96
98
|
versions = [full_ruby_version]
|
97
99
|
(0..3).reverse_each { |i| versions << full_ruby_version.split(".")[0, i].join(".") }
|
98
100
|
versions << RUBY_ENGINE
|
99
101
|
|
100
102
|
versions.map do |version|
|
101
|
-
Dir[File.join(dir, "#{binary_name}_#{version}.supp")]
|
103
|
+
old_format_files = Dir[File.join(dir, "#{binary_name}_#{version}.supp")]
|
104
|
+
|
105
|
+
unless old_format_files.empty?
|
106
|
+
warn("ruby_memcheck: please migrate your suppression filenames from " \
|
107
|
+
"`gem_name_ruby-3.1.0.supp` to `ruby-3.1.0.supp` (drop the gem name from the filename)")
|
108
|
+
end
|
109
|
+
|
110
|
+
old_format_files + Dir[File.join(dir, "#{version}.supp")]
|
102
111
|
end.flatten
|
103
112
|
end
|
104
113
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
On platforms where memcpy is safe for overlapped memory, the compiler will sometimes replace memmove with memcpy. Valgrind may report a false positive.
|
3
|
+
Memcheck:Overlap
|
4
|
+
fun:__memcpy_chk
|
5
|
+
fun:memmove
|
6
|
+
...
|
7
|
+
}
|
8
|
+
{
|
9
|
+
Requiring a file will add it to the loaded features, which may be reported as a leak.
|
10
|
+
Memcheck:Leak
|
11
|
+
...
|
12
|
+
fun:require_internal
|
13
|
+
...
|
14
|
+
}
|
15
|
+
{
|
16
|
+
Remove this after Ruby 2.7.7, 3.0.5, 3.1.3 are relased. See: https://github.com/Shopify/ruby_memcheck/issues/6
|
17
|
+
Memcheck:Leak
|
18
|
+
...
|
19
|
+
fun:stack_chunk_alloc
|
20
|
+
...
|
21
|
+
}
|
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: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Zhu
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '2.3'
|
125
|
-
description:
|
125
|
+
description:
|
126
126
|
email:
|
127
127
|
- peter@peterzhu.ca
|
128
128
|
executables: []
|
@@ -148,12 +148,13 @@ files:
|
|
148
148
|
- lib/ruby_memcheck/valgrind_error.rb
|
149
149
|
- lib/ruby_memcheck/version.rb
|
150
150
|
- ruby_memcheck.gemspec
|
151
|
+
- suppressions/ruby.supp
|
151
152
|
homepage: https://github.com/peterzhu2118/ruby_memcheck
|
152
153
|
licenses:
|
153
154
|
- MIT
|
154
155
|
metadata:
|
155
156
|
homepage_uri: https://github.com/peterzhu2118/ruby_memcheck
|
156
|
-
post_install_message:
|
157
|
+
post_install_message:
|
157
158
|
rdoc_options: []
|
158
159
|
require_paths:
|
159
160
|
- lib
|
@@ -169,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
170
|
version: '0'
|
170
171
|
requirements: []
|
171
172
|
rubygems_version: 3.3.7
|
172
|
-
signing_key:
|
173
|
+
signing_key:
|
173
174
|
specification_version: 4
|
174
175
|
summary: Use Valgrind memcheck without going crazy
|
175
176
|
test_files: []
|