Ruby ObjectSpace Functions

EditRocket provides the following information on ObjectSpace functions in the Ruby source code builder.

add_finalizer(p1) - deprecated

call_finalizer(p1) - deprecated

define_finalizer(obj, aProc=proc() - Adds aProc as a finalizer, to be called after obj was destroyed.

each_object([module]) - Calls the block once for each living, nonimmediate object in this Ruby process. If module is specified, calls the block for only those classes or modules that match (or are a subclass of) module. Returns the number of objects found. Immediate objects (Fixnums, Symbols true, false, and nil) are never returned. In the example below, each_object returns both the numbers we defined and several constants defined in the Math module.

finalizers() - deprecated

garbage_collect - Initiates garbage collection, unless manually disabled.

remove_finalizer(p1) - deprecated

undefine_finalizer(obj) - Removes all finalizers for obj.