[MacRuby] #617: Reopening Symbol Appears to Cause auto malloc[16067]: error for object 0x1016090b0: auto_zone_set_associative_ref
#617: Reopening Symbol Appears to Cause auto malloc[16067]: error for object 0x1016090b0: auto_zone_set_associative_ref -------------------------------+-------------------------------------------- Reporter: cwdinfo@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: -------------------------------+-------------------------------------------- This works in MRI 1.87 and 1.9.1. {{{ #!/usr/local/bin/macruby class Predicate OPERATOR_MAP = { :gt => '>', :lt => '<', :eq => '=' } def initialize(obj, operator, rhs) @obj = obj.to_s @predicate = to_condition(operator, rhs) end def gt(rhs) @predicate << @conjoin @predicate << to_condition(:gt, rhs) self end def lt(rhs) @predicate << @conjoin @predicate << to_condition(:lt, rhs) self end def eq(rhs) @predicate << @conjoin @predicate << to_condition(:lt, rhs) self end def and @conjoin = ' and ' self end def or @conjoin = ' or ' self end def to_condition(operator, rhs) "#{@obj} #{OPERATOR_MAP[operator]} #{rhs}" end def to_s @predicate end end class Symbol def gt(value) @predicate = Predicate.new(self, :gt, value) end def lt(value) @predicate = Predicate.new(self, :lt, value) end def eq(value) @predicate = Predicate.new(self, :eq, value) end end puts :start_time.eq('2010-10-01') puts :start_time.eq('2010-10-01').and.lt('2010-10-03')}}} }}} Error is: {{{ macruby(16067,0x7fff70f36be0) malloc: *** auto malloc[16067]: error for object 0x1016090b0: auto_zone_set_associative_ref: object should point to a GC block or a global address, otherwise associations will leak. Break on auto_zone_association_error() to debug. }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/617> MacRuby <http://macruby.org/>
#617: Reopening Symbol Appears to Cause auto malloc[16067]: error for object 0x1016090b0: auto_zone_set_associative_ref -------------------------------+-------------------------------------------- Reporter: cwdinfo@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: -------------------------------+-------------------------------------------- Comment(by cwdinfo@…): This appears to be related to the fact that Symbol inherits from NSString, which is immutable. A simple reduced case is: {{{ class Symbol def eq @foo = 3 end end :zoo.eq }}} At this point, the object is changed, which appears not to be desirable in the context of immutability, yet Ruby 1.9 allows it and many Ruby idioms take advantage of it (e.g., DataMapper). -- Ticket URL: <http://www.macruby.org/trac/ticket/617#comment:1> MacRuby <http://macruby.org/>
#617: Reopening Symbol Appears to Cause auto malloc[16067]: error for object 0x1016090b0: auto_zone_set_associative_ref -------------------------------+-------------------------------------------- Reporter: cwdinfo@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: -------------------------------+-------------------------------------------- Comment(by lsansonetti@…): We are rewriting Symbol (as well as String and Regexp) in a separate branch right now. Symbol will be a separate class as in 1.9 and hopefully this problem will disappear. -- Ticket URL: <http://www.macruby.org/trac/ticket/617#comment:2> MacRuby <http://macruby.org/>
#617: Reopening Symbol Appears to Cause auto malloc[16067]: error for object 0x1016090b0: auto_zone_set_associative_ref -------------------------------+-------------------------------------------- Reporter: cwdinfo@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: -------------------------------+-------------------------------------------- Comment(by lsansonetti@…): As of trunk r3858, it fails like this: {{{ $ cat t.rb class Symbol def eq @foo=42 end end p :foo.eq $ ./miniruby t.rb miniruby(70683,0x7fff7056bc00) malloc: *** auto malloc[70683]: error for object 0x7ffee30ba270: auto_zone_set_associative_ref: object should point to a GC block or a global address, otherwise associations will leak. Break on auto_zone_association_error() to debug. 42 }}} This is because symbols are allocated from the regular malloc zone and cannot be used for associative references. -- Ticket URL: <http://www.macruby.org/trac/ticket/617#comment:3> MacRuby <http://macruby.org/>
#617: Reopening Symbol Appears to Cause auto malloc[16067]: error for object 0x1016090b0: auto_zone_set_associative_ref -------------------------------+-------------------------------------------- Reporter: cwdinfo@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.7 Component: MacRuby | Resolution: fixed Keywords: | -------------------------------+-------------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.7 Comment: Should be fixed in r4073. -- Ticket URL: <http://www.macruby.org/trac/ticket/617#comment:4> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby