mruby-os-memsize/memsize.c: add up digit spaces for big-integers.
MODIFY
include/mruby/internal.h
include/mruby/internal.h
@@ -185,6 +185,7 @@ mrb_int mrb_bint_as_int(mrb_state *mrb, mrb_value x);
mrb_int mrb_bint_cmp(mrb_state *mrb, mrb_value x, mrb_value y);
void mrb_gc_free_bint(mrb_state *mrb, struct RBasic *x);
void mrb_bint_copy(mrb_state *mrb, mrb_value x, mrb_value y);
+size_t mrb_bint_memsize(mrb_value x);
#endif
#endif /* MRUBY_INTERNAL_H */

MODIFY
mrbgems/mruby-bigint/core/bigint.c
mrbgems/mruby-bigint/core/bigint.c
@@ -1492,3 +1492,10 @@ mrb_bint_copy(mrb_state *mrb, mrb_value x, mrb_value y)
struct RBigint *b2 = RBIGINT(y);
mpz_init_set(mrb, &b->mp, &b2->mp);
}
+
+size_t
+mrb_bint_memsize(mrb_value x)
+{
+ struct RBigint *b = RBIGINT(x);
+ return b->mp.sz * sizeof(mp_limb);
+}

MODIFY
mrbgems/mruby-os-memsize/src/memsize.c
mrbgems/mruby-os-memsize/src/memsize.c
@@ -146,6 +146,9 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
#endif
break;
case MRB_TT_BIGINT:
+#if defined(MRB_USE_BIGINT)
+ size += mrb_bint_memsize(obj);
+#endif
case MRB_TT_DATA:
case MRB_TT_ISTRUCT:
size += mrb_objspace_page_slot_size();

mruby-os-memsize/memsize.c: add up digit spaces for big-integers.