Skip to content

Handle STR_NOFREE strings properly #93

Open
@wks

Description

@wks

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions