Add NUL terminator to string object size calculation; ref #5032

This commit is contained in:
dearblue
2020-07-21 23:40:37 +09:00
parent 97f71b5a67
commit 2b588b8566
+1
View File
@@ -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: