ruby-changes:54835
From: ko1 <ko1@a...>
Date: Tue, 12 Feb 2019 12:45:21 +0900 (JST)
Subject: [ruby-changes:54835] ko1:r67054 (trunk): fix empty Hash memsize.
ko1 2019-02-12 12:45:15 +0900 (Tue, 12 Feb 2019) New Revision: 67054 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67054 Log: fix empty Hash memsize. * gc.c (obj_memsize_of): ar_table ptr can be NULL (size == 0). Modified files: trunk/gc.c Index: gc.c =================================================================== --- gc.c (revision 67053) +++ gc.c (revision 67054) @@ -3356,8 +3356,10 @@ obj_memsize_of(VALUE obj, int use_all_ty https://github.com/ruby/ruby/blob/trunk/gc.c#L3356 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/