1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

fix empty Hash memsize.

* gc.c (obj_memsize_of): ar_table ptr can be NULL (size == 0).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2019-02-12 03:45:15 +00:00
parent 9653f770ae
commit 91cb5c1a70

6
gc.c
View file

@ -3356,8 +3356,10 @@ obj_memsize_of(VALUE obj, int use_all_types)
break;
case T_HASH:
if (RHASH_AR_TABLE_P(obj)) {
size_t rb_hash_ar_table_size();
size += rb_hash_ar_table_size();
if (RHASH_AR_TABLE(obj) != NULL) {
size_t rb_hash_ar_table_size();
size += rb_hash_ar_table_size();
}
}
else {
VM_ASSERT(RHASH_ST_TABLE(obj) != NULL);