Fixed wrong size calculation for `memsize_of()`.

parent 55163a8a
...@@ -108,17 +108,6 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj) ...@@ -108,17 +108,6 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
if(!MRB_PROC_CFUNC_P(proc)) size += os_memsize_of_irep(mrb, proc->body.irep); if(!MRB_PROC_CFUNC_P(proc)) size += os_memsize_of_irep(mrb, proc->body.irep);
break; break;
} }
case MRB_TT_DATA:
size += mrb_objspace_page_slot_size();
break;
#ifndef MRB_NO_FLOAT
case MRB_TT_FLOAT:
#ifdef MRB_WORD_BOXING
size += mrb_objspace_page_slot_size() +
sizeof(struct RFloat);
#endif
break;
#endif
case MRB_TT_RANGE: case MRB_TT_RANGE:
#ifndef MRB_RANGE_EMBED #ifndef MRB_RANGE_EMBED
size += mrb_objspace_page_slot_size() + size += mrb_objspace_page_slot_size() +
...@@ -131,12 +120,18 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj) ...@@ -131,12 +120,18 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
ptrdiff_t ci_size = f->cxt->ciend - f->cxt->cibase; ptrdiff_t ci_size = f->cxt->ciend - f->cxt->cibase;
size += mrb_objspace_page_slot_size() + size += mrb_objspace_page_slot_size() +
sizeof(struct RFiber) +
sizeof(struct mrb_context) + sizeof(struct mrb_context) +
sizeof(mrb_value) * stack_size + sizeof(mrb_value) * stack_size +
sizeof(mrb_callinfo) * ci_size; sizeof(mrb_callinfo) * ci_size;
break; break;
} }
#ifndef MRB_NO_FLOAT
case MRB_TT_FLOAT:
#endif
case MRB_TT_INTEGER:
if (mrb_immediate_p(obj))
break;
case MRB_TT_DATA:
case MRB_TT_ISTRUCT: case MRB_TT_ISTRUCT:
size += mrb_objspace_page_slot_size(); size += mrb_objspace_page_slot_size();
break; break;
...@@ -144,7 +139,6 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj) ...@@ -144,7 +139,6 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
* immediate VM stack values, contained within mrb_state, or on C stack */ * immediate VM stack values, contained within mrb_state, or on C stack */
case MRB_TT_TRUE: case MRB_TT_TRUE:
case MRB_TT_FALSE: case MRB_TT_FALSE:
case MRB_TT_INTEGER:
case MRB_TT_BREAK: case MRB_TT_BREAK:
case MRB_TT_CPTR: case MRB_TT_CPTR:
case MRB_TT_SYMBOL: case MRB_TT_SYMBOL:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment