ObjectSpace

ObjectSpace

ri

 ----------------------------------------------------- Class: ObjectSpace
      The  ObjectSpace  module contains a number of routines that
      interact with the garbage collection facility and allow you to
      traverse all living objects with an iterator.
 
       ObjectSpace  also provides support for object finalizers, procs
      that will be called when a specific object is about to be destroyed
      by garbage collection.
 
         include ObjectSpace
      
         a = "A"
         b = "B"
         c = "C"
      
         define_finalizer(a, proc {|id| puts "Finalizer one on #{id}" })
         define_finalizer(a, proc {|id| puts "Finalizer two on #{id}" })
         define_finalizer(b, proc {|id| puts "Finalizer three on #{id}" })
 
      _produces:_
 
         Finalizer three on 537763470
         Finalizer one on 537763480
         Finalizer two on 537763480
 
 ------------------------------------------------------------------------
 
 
 Instance methods:
 -----------------
      _id2ref, add_finalizer, call_finalizer, define_finalizer,
      each_object, finalizers, garbage_collect, remove_finalizer,
      undefine_finalizer