mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Remove use of symbols and arrays when freeing global table
This removes the use of symbol and array objects when freeing the global table so we can now free symbols and arrays earlier.
This commit is contained in:
parent
89ebe8993f
commit
32683aa18d
2 changed files with 3 additions and 10 deletions
9
gc.c
9
gc.c
|
@ -4316,13 +4316,8 @@ rb_objspace_free_objects_i(VALUE obj, void *data)
|
|||
{
|
||||
rb_objspace_t *objspace = (rb_objspace_t *)data;
|
||||
|
||||
switch (BUILTIN_TYPE(obj)) {
|
||||
case T_NONE:
|
||||
case T_SYMBOL:
|
||||
break;
|
||||
default:
|
||||
if (BUILTIN_TYPE(obj) != T_NONE) {
|
||||
obj_free(objspace, obj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4350,8 +4345,6 @@ rb_objspace_call_finalizer_i(VALUE obj, void *data)
|
|||
case T_FILE:
|
||||
obj_free(objspace, obj);
|
||||
break;
|
||||
case T_SYMBOL:
|
||||
case T_ARRAY:
|
||||
case T_NONE:
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -451,7 +451,7 @@ struct rb_global_entry {
|
|||
};
|
||||
|
||||
static enum rb_id_table_iterator_result
|
||||
free_global_entry_i(ID key, VALUE val, void *arg)
|
||||
free_global_entry_i(VALUE val, void *arg)
|
||||
{
|
||||
struct rb_global_entry *entry = (struct rb_global_entry *)val;
|
||||
if (entry->var->counter == 1) {
|
||||
|
@ -467,7 +467,7 @@ free_global_entry_i(ID key, VALUE val, void *arg)
|
|||
void
|
||||
rb_free_rb_global_tbl(void)
|
||||
{
|
||||
rb_id_table_foreach(rb_global_tbl, free_global_entry_i, 0);
|
||||
rb_id_table_foreach_values(rb_global_tbl, free_global_entry_i, 0);
|
||||
rb_id_table_free(rb_global_tbl);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue