Revert "Add Valgrind memcheck (ruby_memcheck) for the C extension" - #150
Merged
Conversation
Watson1978
added a commit
to Watson1978/zstd-ruby
that referenced
this pull request
Aug 9, 2026
Running the suite under Valgrind on a Ruby C extension is normally impractical:
the interpreter itself produces a large volume of reports that have nothing to
do with the extension. ruby_memcheck wraps Valgrind and only surfaces errors
whose stack trace passes through the extension's .so, which makes the output
usable. It is the same tool Shopify runs on nokogiri and liquid-c.
rake spec:valgrind
This reworks SpringMT#147, which was reverted in SpringMT#150 because it broke CI: the Gemfile
guarded the dependency on Linux but not on the Ruby version, and ruby_memcheck
3.x requires Ruby >= 3.0, so `bundle install` failed on the 2.7 entry of the
matrix. The guard now covers both. Verified on Ruby 2.7.8 locally: bundle
install, rake compile and rspec all pass, and the Rakefile simply does not
define the task there.
The memcheck run gets its own workflow rather than a job inside Ruby.yml, so a
report from it cannot turn the main test matrix red. It pins one Ruby, installs
Valgrind, and carries a 30 minute job timeout; a cold run -- extension build
plus the suite under memcheck -- takes about 1m45s locally.
The suite reports nothing on the current tree, so no suppression file is
needed. The task does have teeth: run against the use-after-free of a stream's
borrowed CDict/DDict it reports 113 Invalid read records, and against the
ZSTD_DCtx leak it reports the context as definitely lost, both attributed
inside zstdruby.so.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reverts #147