Add NUL terminator to string object size calculation; ref
@@ -54,6 +54,7 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
size += mrb_objspace_page_slot_size();
if (!RSTR_EMBED_P(RSTRING(obj)) && !RSTR_SHARED_P(RSTRING(obj))) {
size += RSTRING_CAPA(obj);
+ size++; /* NUL terminator */
}
break;
case MRB_TT_CLASS:
