mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
array.c (ary_recycle_hash): use rb_gc_force_recycle
Hidden objects (RBASIC_CLASS(hash) == 0) can never become visible to other threads or signal handlers via ObjectSpace.each_object or similar means. Thus it is safe to forcibly recycle the object slot for future use, here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d6de5804ea
commit
302ae913e0
1 changed files with 2 additions and 2 deletions
4
array.c
4
array.c
|
@ -4095,12 +4095,12 @@ ary_make_hash_by(VALUE ary)
|
|||
static inline void
|
||||
ary_recycle_hash(VALUE hash)
|
||||
{
|
||||
assert(RBASIC_CLASS(hash) == 0);
|
||||
if (RHASH(hash)->ntbl) {
|
||||
st_table *tbl = RHASH(hash)->ntbl;
|
||||
RHASH(hash)->ntbl = 0;
|
||||
st_free_table(tbl);
|
||||
}
|
||||
RB_GC_GUARD(hash);
|
||||
rb_gc_force_recycle(hash);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue