Bug #19381
closedSEGV - ivars, both Ubuntu & Windows
Description
I've used code similar to the below for a long time. When max is set to 50, it runs. When max is set to 51, it SEGV faults.
Rubies tested:
ruby 3.3.0dev (2023-01-26T07:31:08Z master 6422fef90c) [x86_64-linux]
ruby 3.3.0dev (2023-01-26T07:31:08Z master 6422fef90c) [x64-mingw-ucrt]
ruby 3.3.0dev (2023-01-26T07:31:08Z master 6422fef90c) [x64-mswin64_140]
I suspect it involves the changes in https://github.com/ruby/ruby/pull/7183 'Limit maximum number of IVs on a shape'
module Test
class << self
def run
max = 51
(1..max).each do |v|
instance_variable_set("@iv#{v}".to_sym, nil)
end
end
end
end
Test.run
puts Test.instance_variables
Updated by luke-gru (Luke Gruber) almost 2 years ago
Recently there was a change to object shapes, and there were no tests made for that commit. I think they'll add some now :)
The change is here, made on Jan. 25: https://github.com/ruby/ruby/commit/78fcc9847a9db6d42c8c263154ec05903a370b6b
It looks like objects other than T_OBJECTs are being set to TOO_COMPLEX shape.
EDIT: oh sorry I didn't see you added the PR in your ticket MSP-Greg.
Updated by MSP-Greg (Greg L) almost 2 years ago
Thanks. That's the commit for the PR I listed (#7183). I should have listed it...
Updated by tenderlovemaking (Aaron Patterson) almost 2 years ago
Thanks. I'm going to revert the commit for now. 🙇🏻♀️
Updated by Eregon (Benoit Daloze) almost 2 years ago
- Related to Bug #19334: Defining many instance variables and accessing them is slow in Ruby 3.2.0 added
Updated by jeremyevans0 (Jeremy Evans) almost 2 years ago
- Status changed from Open to Closed