class Class

Hack the ‘Class’-class in order to get callbacks when objects are created.

Public Instance Methods

__memory_leak_helper_original_new(*args, &blk)

Alias the original new-method to a method that hopefully will never be found.

Alias for: new
new(*args, &blk) click to toggle source

Make a new method that will be called whenever an object is created. Register that object with ‘Memory_leak_helper’ and return it as it normally would.

# File lib/memory_leak_helper.rb, line 90
def new(*args, &blk)
  mlh = Memory_leak_helper::INSTANCE
  obj = __memory_leak_helper_original_new(*args, &blk)
  mlh.register_object(:obj => obj, :caller => caller) if mlh
  
  return obj
end