[MacRuby] #1153: segfault during define_method

MacRuby ruby-noreply at macosforge.org
Mon Feb 7 06:38:58 PST 2011


#1153: segfault during define_method
----------------------------------+-----------------------------------------
 Reporter:  al_skipp@…            |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Discovered this whilst trying to benchmark a proxy class. The code below
 consistently fails after the 67th iteration on my mac.

 {{{
 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

 100.times do |i|
   hash = Proxy.new(Hash.new)
   puts i
 end
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1153>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list