From: Robert Klemme Date: 2006-07-06T22:56:27+09:00 Subject: Re: [BUG] thread/sync.rb memory corruption Ara, I still believe the error is in the script (see my other posting). Kind regards robert 2006/7/6, ara.t.howard@noaa.gov : > > i'm using ef (electric fence) to show the memory corruption in this script. > to cause it corrupt memory use > > CORRUPT=true ef ruby bug.rb > > file: bug.rb > > require 'sync' > > class A > def initialize > extend Sync_m > @observers = [] > end > def meth > synchronize(:EX){ > @observers.each do |o| > if ENV['CORRUPT'] > o.notify nil > else > o.notify > end > end > } > end > def add_observer o > synchronize(:EX){ > @observers << o > } > end > end > > class B > def initialize a > @a = a > @a.add_observer self > end > def notify *a > Thread.new{ @a.meth } > end > end > > a = A.new > b = B.new a > a.meth > STDIN.gets > > > note that it is the simple passing, or not, of arguments to the notify method > which triggers the bug. perhaps this will yield some hints. > > > regards. > > -a > -- > suffering increases your inner strength. also, the wishing for suffering > makes the suffering disappear. > - h.h. the 14th dali lama > > -- Have a look: http://www.flickr.com/photos/fussel-foto/