Description
In the mmtk
and the dev/mmtk-overrides-default
branches, we reimplemented part of String
to allocate the buffer in the MMTk heap instead of in the C heap using xmalloc
. In many places, the code erroneously assumed that a non-embedded string must have an underlying RSTRING_EXT(str)->strbuf
. But for strings with the STR_NOFREE
flag, it is not the case. The actual string contents are allocated in C buffers, usually static variables for string literals, that are not supposed to be managed by the GC or freed manually.
We should go through all use cases of strbuf
to see if they consider STR_NOFREE
.
And we should revisit all assignments to RSTRING(str)->as.heap.ptr
to see if there are newly added cases of xmalloc
. One example is an rb_xmalloc_mul_add_mul
in rb_str_tmp_frozen_no_embed_acquire
.