summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-11-13 18:13:46 +0900
committerGitHub <[email protected]>2020-11-13 18:13:46 +0900
commit7fb62670a9a8b06066e39048ab792594e8fc2bff (patch)
tree125d62abdbcfb46b4a5df8c2bf9ee626518f483e
parent75beb55c2af7172dd2b1b026ed3d3f7f58c93e2e (diff)
parent292a0961188127948f77065318a5b59780ea7560 (diff)
downloadmruby-7fb62670a9a8b06066e39048ab792594e8fc2bff.tar.gz
mruby-7fb62670a9a8b06066e39048ab792594e8fc2bff.zip
Merge pull request #5127 from shuujii/include-size-of-iv-table-in-ObjectSpace.memsize_of-to-Hash-object
Include size of iv table in `ObjectSpace.memsize_of` to `Hash` object
-rw-r--r--src/hash.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/hash.c b/src/hash.c
index 5b5fc65b6..b049111b6 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -1034,10 +1034,11 @@ size_t
mrb_hash_memsize(mrb_value self)
{
struct RHash *h = mrb_hash_ptr(self);
- return h_ar_p(h) ? (ar_ea_capa(h) * sizeof(hash_entry)) :
- (ht_ea_capa(h) * sizeof(hash_entry) +
- sizeof(hash_table) +
- ib_byte_size_for(ib_bit(h)));
+ return mrb_obj_iv_tbl_memsize(self) +
+ (h_ar_p(h) ? (ar_ea_capa(h) * sizeof(hash_entry)) :
+ (ht_ea_capa(h) * sizeof(hash_entry) +
+ sizeof(hash_table) +
+ ib_byte_size_for(ib_bit(h))));
}
/* Iterates over the key/value pairs. */