[MacRuby-devel] proxy object - define_method crash

Alan Skipp al_skipp at fastmail.fm
Sat Jan 29 09:52:03 PST 2011


I've reduced the problem to the code below. Creating 1000 proxy objects in a loop isn't a typical use case, but it does occur when benchmarking and the crash report is pretty consistent each time.
Should I open a ticket for this issue?

Alan

------

class Proxy
  def initialize(delegate)
    @delegate = delegate

    @delegate.public_methods.each do |meth|
      (class << self; self; end).class_eval do
        define_method meth do |*args, &block|
          @delegate.__send__(meth, *args)
        end
      end
    end
    
  end
end

1000.times do
  hash = Proxy.new(Hash.new)
end


More information about the MacRuby-devel mailing list