General

Profile

hanazuki (Kasumi Hanazuki)

  • Login: hanazuki
  • Registered on: 11/21/2017
  • Last sign in: 09/04/2025

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 2 12 14

Activity

06/18/2025

06:39 AM Ruby Bug #21210: IO::Buffer gets invalidated on GC compaction
I think @alanwu means the mutable buffer path (IO::Buffer.for w/ block) uses rb_str_locktmp to pin the String's malloc'ed content memory (not RString), while the immutable buffer path (IO::Buffer.for w/o block) utilizes CoW to obtain a f... hanazuki (Kasumi Hanazuki)

06/17/2025

05:57 AM Ruby Bug #21210 (Closed): IO::Buffer gets invalidated on GC compaction
Applied in changeset commit:git|8aac19d5987150cf5c45fee73c7a949ca472f488.
----------
io_buffer: Reimplement dcompact for IO::Buffer
The `source` field in IO::Buffer can have a String or an IO::Buffer
object, if not nil.
- When the `so...
hanazuki (Kasumi Hanazuki)
05:57 AM Ruby Revision 4cc58c3a (git): Revert "Mark rb_io_buffer_type references declaratively"
This reverts commit 6012145299cfa4ab561360c78710c7f2941a7e9d. hanazuki (Kasumi Hanazuki)
05:57 AM Ruby Revision 8aac19d5 (git): io_buffer: Reimplement dcompact for IO::Buffer
The `source` field in IO::Buffer can have a String or an IO::Buffer
object, if not nil.
- When the `source` is a String object. The `base` field points to the
memory location of the String content, which can be embedded in
RSTRING, ...
hanazuki (Kasumi Hanazuki)

06/16/2025

11:21 PM Ruby Bug #20998: rb_str_locktmp() changes flags of frozen strings and string literals
FYI: IO::Buffer is now broken (by a recent change) because the embedded Strings are not pinned, and I'm proposing a fix at #21210 hanazuki (Kasumi Hanazuki)

04/16/2025

03:45 PM Ruby Bug #21212: IO::Buffer can be freed while its slice is locked
I think the problem is that each IO::Buffer slice manages the lock state independently, and so the root IO::Buffer cannot know whether the memory is locked by one of its slices.
If the memory is being accessed by a native function lik...
hanazuki (Kasumi Hanazuki)

04/02/2025

04:53 AM Ruby Bug #21212 (Assigned): IO::Buffer can be freed while its slice is locked
```ruby
buffer = IO::Buffer.new(100)
slice = buffer.slice
buffer.locked do
buffer.free rescue p $! #=> IO::Buffer::LockedError (expected)
end
slice.locked do
p slice.locked? #=> true (expected)
p buffer.locked? #=> f...
hanazuki (Kasumi Hanazuki)
02:40 AM Ruby Bug #21210: IO::Buffer gets invalidated on GC compaction
alanwu (Alan Wu) wrote in #note-5:
> Another option that maintains validity across movement (untested):
> ...
So this will copy the embedded String content to a malloc'ed memory, right?
The default GC embeds up to 640 bytes minus RS...
hanazuki (Kasumi Hanazuki)
01:39 AM Ruby Bug #21210: IO::Buffer gets invalidated on GC compaction
eightbitraptor (Matt V-H) wrote in #note-4:
> Instead of pinning the source string, did you consider allowing the string to move by calculating the `base` offset, then moving the `source` string and updating the `base` pointer using `rb_...
hanazuki (Kasumi Hanazuki)

04/01/2025

08:10 PM Ruby Bug #21210: IO::Buffer gets invalidated on GC compaction
Patch: https://github.com/ruby/ruby/pull/13033 hanazuki (Kasumi Hanazuki)

Also available in: Atom