Issue #11146 has been reported by Eric Wong.

----------------------------------------
Feature #11146: [PATCH] variable.c: initialize generic_iv_tbl at start
https://bugs.ruby-lang.org/issues/11146

* Author: Eric Wong
* Status: Open
* Priority: Normal
* Assignee: Eric Wong
----------------------------------------
Even miniruby creates one generic ivar (plain "ruby" creates 9),
so there's no point in lazily allocating the table and increasing
lines of code.

I'll commit in a few days unless there's objections.

I dumped generic ivar counts with the following trivial patch:

  --- a/variable.c
  +++ b/variable.c
  @@ -24,6 +24,10 @@ static void check_before_mod_set(VALUE, ID, VALUE, const char *);
   static void setup_const_entry(rb_const_entry_t *, VALUE, VALUE, rb_const_flag_t);
   static int const_update(st_data_t *, st_data_t *, st_data_t, int);
   static st_table *generic_iv_tbl;
  +__attribute__((destructor)) static void count_genivar(void)
  +{
  +    fprintf(stderr, "genivars: %zu\n", (size_t)generic_iv_tbl->num_entries);
  +}

   void
   Init_var_tables(void)


---Files--------------------------------
0001-variable.c-generic_iv_tbl-is-unavoidable.patch (4.79 KB)


-- 
https://bugs.ruby-lang.org/