Re: [MacRuby] #505: ivars are not collected after they are re-assigned by an immediate value
#505: ivars are not collected after they are re-assigned by an immediate value -----------------------------------+---------------------------------------- Reporter: lsansonetti@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: invalid Keywords: | -----------------------------------+---------------------------------------- Changes (by lsansonetti@…): * keywords: 0.11-blocker => * status: new => closed * resolution: => invalid * milestone: MacRuby 1.0 => Comment: I believe the bug is a false positive, it turns out the reduction wasn't good. I double-checked what code the Objective-C compiler generates when assigning ivars to null, and it matches what we do. From http://www.opensource.apple.com/source/objc4/objc4-437/runtime/objc- auto.m: {{{ __private_extern__ id objc_assign_ivar_gc(id value, id base, ptrdiff_t offset) { id *slot = (id*) ((char *)base + offset); if (value) { if (!auto_zone_set_write_barrier(gc_zone, (char *)base + offset, value)) { __private_extern__ void objc_assign_ivar_error(id base, ptrdiff_t offset); _objc_inform("GC: %p + %tu isn't in the auto_zone, break on objc_assign_ivar_error to debug.\n", base, offset); objc_assign_ivar_error(base, offset); } } else *slot = value; return value; } }}} (The write barrier is never emitted if value is null.) Also, I am able to reproduce a crash using this snippet: {{{ ./miniruby -e "class X; def foo; @foo = 'hey'; ocid = @foo.object_id; @foo = nil; ocid; end; end; o=X.new; ocid=o.foo; 1.times { GC.start }; p ObjectSpace._id2ref(ocid)" Segmentation fault }}} Closing as invalid. -- Ticket URL: <http://www.macruby.org/trac/ticket/505#comment:5> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby