## Reproduction ```ruby buffer = IO::Buffer.new(64) slice = buffer.slice(0, 8) slice.resize(0) slice.size # => an arbitrary size or a SEGV ``` The outcome depends on what the stack happens to hold. Reading `slice.inspect` inst...himura467 (Akito Shitara)
Applied in changeset commit:git|a9017ccc1346f620ff1f1b4340fffdd6b4069f96. ---------- str_subseq: copy sharable substrings up to a 256 byte slot Previously the embedded path allocated a full-size embedded string via str_alloc_heap plus ...himura467 (Akito Shitara)
Previously the embedded path allocated a full-size embedded string via str_alloc_heap plus STR_SET_EMBED, which capped the copy at the default struct RString slot whatever the substring length. Size the allocation to the substring with s...himura467 (Akito Shitara)
byroot (Jean Boussier) wrote in #note-13: > We could also have a different limit depending on the status of the source string. If the source string is already frozen or shared, creating an extra shared string is much cheaper, so we could...himura467 (Akito Shitara)
* [Feature #22186] Increase the embeddable size limit for substrings created by `str_subseq()` (himura467) * `str_subseq()` copies a sharable substring only while it fits in the tiny slot. The proposal copies up to a 128 byte slot, ke...himura467 (Akito Shitara)
* [Feature #22231] Add `IO::Buffer#index` (himura467) * `IO::Buffer` has no search primitive, so finding a delimiter means copying the region out with `#get_string` or looping over `#get_value(:U8)` in Ruby. Proposes `buffer.index(o...himura467 (Akito Shitara)
## Use case I am writing nack-ruby (https://github.com/nsgi-org/nack-ruby), a Ruby implementation of NSGI, a host/guest interface for web applications. The host hands each HTTP request field to Ruby as an `IO::Buffer` view over its ow...himura467 (Akito Shitara)
### PR for `IO::Buffer#free` and `IO::Buffer#resize`: https://github.com/ruby/ruby/pull/18129 for `IO::Buffer#transfer`: https://github.com/ruby/ruby/pull/18130himura467 (Akito Shitara)
Currently `IO::Buffer#free`, `#resize` and `#transfer` can be called even if the receiver is frozen. All three release, reallocate or hand away the memory the buffer references, so they change the state of the buffer. Therefore it seems ...himura467 (Akito Shitara)
st_table_size() is the number of entries, but ractor_memsize() adds the result to sizeof(rb_ractor_t) as a byte count, so a Ractor was reported as costing one byte per open port. Use st_memsize(), as ractor_selector_memsize() in this fil...himura467 (Akito Shitara)