Repository navigation
Free Ruby-allocated memory with xfree - #88
Merged
Merged
Conversation
ruby-head on mswin now allocates ruby_xmalloc and its family with mimalloc when built with --with-mimalloc, which the mswin binaries are. The CRT free in olevariant_free then corrupted the heap at exit, so even `require "win32ole"` ended with 0xC0000374. Every free here releases memory from ALLOC, ALLOC_N or TypedData_Make_Struct. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bare `mswin` only follows ruby-head, so the released mswin build was not tested at all. Co-Authored-By: Claude Opus 5.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.
The mswin job on ruby-head stops with
rake aborted!andSignalException: SIGSEGVbefore any test output, as on #86 and #87. Evenruby -e 'require "win32ole"'exits with 0xC0000374 there.The mswin ruby-head binaries are now built with
--with-mimalloc, soruby_xmallocallocates from mimalloc, and NEWS notes that freeing it withfreecrashes. This extension freed memory fromALLOC,ALLOC_NandTypedData_Make_Structwith the CRTfree, andolevariant_freeon theWIN32OLE::Variantconstants corrupted the heap at exit. This usesxfreeinstead.I ran
bundle exec rakeon Windows with ruby 4.1.0dev 3288e455a0 and 42a644f6e0 (both mimalloc) and with 4.0.10. Each run gave 225 tests, 0 failures.Generated with Claude Code