Fix `memsize_of` Fibers;
Memory size of a Fiber is calculated by stack size only in CRuby.
MODIFY
mrbgems/mruby-objectspace/src/mruby_objectspace.c
mrbgems/mruby-objectspace/src/mruby_objectspace.c
@@ -293,21 +293,8 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
break;
case MRB_TT_FIBER: {
struct RFiber* f = (struct RFiber *)mrb_ptr(obj);
- mrb_callinfo *ci_p = f->cxt->cibase;
ptrdiff_t stack_size = f->cxt->stend - f->cxt->stbase;
ptrdiff_t ci_size = f->cxt->ciend - f->cxt->cibase;
- mrb_int i = 0;
-
- while(ci_p < f->cxt->ciend) {
- if(ci_p->proc) size += os_memsize_of_irep(mrb, ci_p->proc->body.irep);
- ci_p++;
- }
-
- if(f->cxt->esize) {
- for(i = 0; i <= f->cxt->esize; i++) {
- size += os_memsize_of_irep(mrb, f->cxt->ensure[i]->body.irep);
- }
- }
size += mrb_objspace_page_slot_size() +
sizeof(struct RFiber) +

MODIFY
mrbgems/mruby-objectspace/test/objectspace.rb
mrbgems/mruby-objectspace/test/objectspace.rb
@@ -130,7 +130,6 @@ assert 'ObjectSpace.memsize_of' do
# fiber
empty_fiber_size = ObjectSpace.memsize_of(Fiber.new {})
assert_not_equal empty_fiber_size, 0, 'empty fiber not zero'
- assert_operator empty_fiber_size, :<, ObjectSpace.memsize_of(Fiber.new { yield; 1 }), 'Fiber code size growth'
#hash
assert_not_equal ObjectSpace.memsize_of({}), 0, 'empty hash size not zero'

Fix `memsize_of` Fibers; #5032

Memory size of a Fiber is calculated by stack size only in CRuby.