End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
ObjectSpace.allocation_sourcefile
allocation_sourcefile(object) → string
ext/objspace/object_tracing.c
View on GitHub ↗
static VALUE
allocation_sourcefile(VALUE self, VALUE obj)
{
struct allocation_info *info = lookup_allocation_info(obj);
if (info && info->path) {
return rb_str_new2(info->path);
}
else {
return Qnil;
}
}
Returns the source file origin from the given object.
See ::trace_object_allocations for more information and examples.
See also
.allocation_method_id
.allocation_sourceline
.allocation_generation
.count_imemo_objects
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0