ruby_memcheck 2.1.1 → 2.2.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: '0228bfb7a5cb25e9186f0e2702d4ce746b401ce580d8dfaa83af218a513fca8e'
4
- data.tar.gz: 35e58e193c25c4d27aecdf46b962b115f443c52d1431c39deb53cb5ddc7c3e6d
3
+ metadata.gz: b92b8da7d5b0b160d1478860bb1433d609f2d55d131ac0278405888f4d70cd81
4
+ data.tar.gz: 486f1105d72fd37920366f9185d5d6df8a9c56a78cdbfcfa2998dc1661753875
5
5
  SHA512:
6
- metadata.gz: e8fc3da2b1795fd7bde1a0e91b75c918540d194d875cbd9e8633de442859ac0d3c1eb10d70d1cb6d97655eba5c8262d8ec01e9d9dd8003ba75852bfa4e22314d
7
- data.tar.gz: 936e627d62f56650fa074cd904922d154631bc08047ea8c6e1516481e895fa2c40001db02b1335feb287d919b6c06ce119d17bca7533af4ed8f25d12be437692
6
+ metadata.gz: 0da9f77d836712bb76324e3dec684ecd86bd9a566f34361a32789eb1f5f96ddea5a20ef8899f1821bb270964e7247fc0838eea90102562aedd700631e28e750d
7
+ data.tar.gz: 5039e14c28b608777a2ff05a2d66a3d17ec37bde48f5279078262a606330f06c3a65d952934f2eeb733adc395e2a0b94ecf3f794e1cb10c3e1d9637983738dca
@@ -20,7 +20,9 @@ jobs:
20
20
  # - run: sudo apt-get install -y valgrind
21
21
  # We cannot use Valgrind from apt because we need at least Valgrind 3.20.0
22
22
  # to support DWARF 5
23
- - run: sudo apt-get install -y libc6-dbg
23
+ - run: |
24
+ sudo apt-get update
25
+ sudo apt-get install -y libc6-dbg
24
26
  - name: Install Valgrind from source
25
27
  run: |
26
28
  wget https://sourceware.org/pub/valgrind/valgrind-3.21.0.tar.bz2
data/.gitignore CHANGED
@@ -10,3 +10,4 @@ Gemfile.lock
10
10
  /tmp/
11
11
 
12
12
  *.so
13
+ .DS_Store
data/README.md CHANGED
@@ -153,6 +153,7 @@ If you want to override any of the default configurations you can call `RubyMemc
153
153
 
154
154
  `RubyMemcheck::Configuration` accepts a variety of keyword arguments. Here are all the arguments:
155
155
 
156
+ - `binary_name`: Optional. The name of the only binary to report errors for. Use this if there is too much noise caused by other binaries.
156
157
  - `ruby`: Optional. The command to run to invoke Ruby. Defaults to the Ruby that is currently being used.
157
158
  - `valgrind`: Optional. The command to run to invoke Valgrind. Defaults to the string `"valgrind"`.
158
159
  - `valgrind_options`: Optional. Array of options to pass into Valgrind. This is only present as an escape hatch, so avoid using it. This may be deprecated or removed in future versions.
@@ -31,6 +31,7 @@ module RubyMemcheck
31
31
  /\Arb_yield/,
32
32
  ].freeze
33
33
 
34
+ attr_reader :binary_name
34
35
  attr_reader :ruby
35
36
  attr_reader :valgrind
36
37
  attr_reader :valgrind_options
@@ -57,8 +58,7 @@ module RubyMemcheck
57
58
  output_io: $stderr,
58
59
  filter_all_errors: false
59
60
  )
60
- warn("ruby_memcheck: binary_name is no longer required for configuration") if binary_name
61
-
61
+ @binary_name = binary_name
62
62
  @ruby = ruby
63
63
  @valgrind = valgrind
64
64
  @valgrind_options = valgrind_options
@@ -5,5 +5,18 @@ at_exit do
5
5
  f.write($LOADED_FEATURES.join("\n"))
6
6
  end
7
7
 
8
+ # We need to remove the @_memoized instance variable from Minitest::Spec
9
+ # objects because it holds a hash that contains memoized objects in `let`
10
+ # blocks, this can contain objects that will be reported as a memory leak.
11
+ if defined?(Minitest::Spec)
12
+ require "objspace"
13
+
14
+ ObjectSpace.each_object(Minitest::Spec) do |obj|
15
+ if obj.instance_variable_defined?(:@_memoized)
16
+ obj.remove_instance_variable(:@_memoized)
17
+ end
18
+ end
19
+ end
20
+
8
21
  GC.start
9
22
  end
@@ -42,9 +42,19 @@ module RubyMemcheck
42
42
  @loaded_binaries = loaded_features.keep_if do |feat|
43
43
  # Keep only binaries (ignore Ruby files).
44
44
  File.extname(feat) == ".so"
45
- end.freeze
45
+ end
46
+
47
+ if configuration.binary_name
48
+ @loaded_binaries.keep_if do |feat|
49
+ File.basename(feat, ".*") == configuration.binary_name
50
+ end
51
+
52
+ if @loaded_binaries.empty?
53
+ raise "The Ruby program executed never loaded a binary called `#{configuration.binary_name}`"
54
+ end
55
+ end
46
56
 
47
- @loaded_binaries
57
+ @loaded_binaries.freeze
48
58
  end
49
59
 
50
60
  def valgrind_xml_files
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyMemcheck
4
- VERSION = "2.1.1"
4
+ VERSION = "2.2.0"
5
5
  end
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.1.1
4
+ version: 2.2.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-08-15 00:00:00.000000000 Z
11
+ date: 2023-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri