method
allocation_generation
v2_6_3 -
Show latest stable
- Class:
ObjectSpace
allocation_generation(p1)public
Returns garbage collector generation for the given object.
class B include ObjectSpace def foo trace_object_allocations do obj = Object.new p "Generation is #{allocation_generation(obj)}" end end end B.new.foo #=> "Generation is 3"
See ::trace_object_allocations for more information and examples.