General

Profile

ivoanjo (Ivo Anjo)

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 5 15 20

Activity

12/11/2025

09:45 AM Ruby Bug #21710: Segfault when reading object_id after it is set inside RUBY_INTERNAL_EVENT_NEWOBJ
byroot (Jean Boussier) wrote in #note-24:
> > I just don't think we should support this.
> ...
To be clear, we are aware we're doing really shady weird things to get a bit less overhead / a few more features, etc and we don't expect u...
ivoanjo (Ivo Anjo)

12/04/2025

10:27 AM Ruby Feature #21722: Expose rb_gc_mark_weak API for use in extensions
> @ivoanjo (Ivo Anjo) I don't know if this would work, but what about using rb_postponed_job_trigger to delay adding the object into a WeakMap? (there would also probably need to be a temporary buffer used to mark the object until it is ... ivoanjo (Ivo Anjo)
10:09 AM Ruby Bug #21710: Segfault when reading object_id after it is set inside RUBY_INTERNAL_EVENT_NEWOBJ
> I'm fine with adding MOVEOBJ, it makes sense, but I don't think it's currently necessary. ObjectSpace.trace_object_allocations handles this by subscribing both to NEWOBJ and FREEOBJ and tracking the objects in its own hash table (subsc... ivoanjo (Ivo Anjo)

12/03/2025

11:06 AM Ruby Bug #21710: Segfault when reading object_id after it is set inside RUBY_INTERNAL_EVENT_NEWOBJ
> That sounds like a use case for WeakRef or ObjectSpace::WeakMap.
> ...
In retrospect I was a bit confusing there -- The key missing bit is having something that's safe to use from `NEWOBJ` tracepoint, which is what `WeakRef` and `Weak...
ivoanjo (Ivo Anjo)
09:17 AM Ruby Bug #21710: Segfault when reading object_id after it is set inside RUBY_INTERNAL_EVENT_NEWOBJ
Having `MOVEDOBJ` would be very useful for being able to use the address as identity + I think it may come in handy for caches -- I think it would solve the "a) Be able to identify or reference object without preventing its GC, even if t... ivoanjo (Ivo Anjo)
08:37 AM Ruby Bug #21710: Segfault when reading object_id after it is set inside RUBY_INTERNAL_EVENT_NEWOBJ
> rb_gc_mark_weak can be an option, another may be to have a mechanism to prevent compaction, so you can simply rely on addresses.
Maybe, yeah! Effectively the two requirements I believe are:
a) Be able to identify or reference obj...
ivoanjo (Ivo Anjo)

12/01/2025

02:25 PM Ruby Feature #21722: Expose rb_gc_mark_weak API for use in extensions
Thanks for the hint, Peter! I had not spotted https://bugs.ruby-lang.org/issues/21084 :)
Based on your notes it looks like exposing a `rb_gc_declare_weak_references` is a much better choice 👍
ivoanjo (Ivo Anjo)
10:31 AM Ruby Feature #21722 (Open): Expose rb_gc_mark_weak API for use in extensions
In https://bugs.ruby-lang.org/issues/21710 it came up that
1. On top of [deprecating _id2ref](https://bugs.ruby-lang.org/issues/15408) on Ruby 4.0, [it's a bad idea to be using object_id from the NEWOBJ tracepoint](https://bugs.ruby-l...
ivoanjo (Ivo Anjo)
10:31 AM Ruby Bug #21710: Segfault when reading object_id after it is set inside RUBY_INTERNAL_EVENT_NEWOBJ
Created https://bugs.ruby-lang.org/issues/21722 to ask if `rb_gc_mark_weak` could be made a public symbol ivoanjo (Ivo Anjo)
10:14 AM Ruby Bug #21710: Segfault when reading object_id after it is set inside RUBY_INTERNAL_EVENT_NEWOBJ
> And since rb_gc_mark_weak isn't public API, there's no decent way to have weakrefs in a C extensions (except if you assume/enforce no compaction, then you can use just the address).
Ahhhhh I totally had missed that one. Ever since I...
ivoanjo (Ivo Anjo)

Also available in: Atom