Method: ObjectSpace.allocation_method_id
- Defined in:
- object_tracing.c
.allocation_method_id(object) ⇒ String
Returns the method identifier for the given object.
class A
include ObjectSpace
def foo
trace_object_allocations do
obj = Object.new
p "#{allocation_class_path(obj)}##{allocation_method_id(obj)}"
end
end
end
A.new.foo #=> “Class#new”
See ::trace_object_allocations for more information and examples.
515 516 517 518 519 520 521 522 523 524 525 |
# File 'object_tracing.c', line 515 static VALUE allocation_method_id(VALUE self, VALUE obj) { struct allocation_info *info = lookup_allocation_info(obj); if (info) { return info->mid; } else { return Qnil; } } |