Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle STR_NOFREE strings properly #93

Open
wks opened this issue Sep 12, 2024 · 0 comments
Open

Handle STR_NOFREE strings properly #93

wks opened this issue Sep 12, 2024 · 0 comments

Comments

@wks
Copy link

wks commented Sep 12, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant