Project

General

Profile

Actions

Bug #19381

closed

SEGV - ivars, both Ubuntu & Windows

Added by MSP-Greg (Greg L) almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0dev (2023-01-26T07:31:08Z master 6422fef90c) [x86_64-linux]
[ruby-core:112052]

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

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #19334: Defining many instance variables and accessing them is slow in Ruby 3.2.0Closedtenderlovemaking (Aaron Patterson)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0