From: nobu@... Date: 2015-05-13T03:27:07+00:00 Subject: [ruby-core:69160] [Ruby trunk - Feature #11146] [PATCH] variable.c: initialize generic_iv_tbl at start Issue #11146 has been updated by Nobuyoshi Nakada. Description updated Probably, due to `@gem_prelude_index` of `$LOAD_PATH` elements? ---------------------------------------- Feature #11146: [PATCH] variable.c: initialize generic_iv_tbl at start https://bugs.ruby-lang.org/issues/11146#change-52411 * 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: ~~~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/