From: Logan Capaldo Date: 2006-09-05T04:38:53+09:00 Subject: Re: The real difference between Mutex and Sync On Sep 4, 2006, at 2:50 PM, Kent Sibilev wrote: > > Good findings. > > I think the problem lies in the Array#shift (rb_ary_shift) > implementation. Basically, it just increments the internal pointer and > it never modifies the size of an array. This means that if you have an > array with 1000 elements and you 'shift' it 999 times, all these > elements are still visible to the garbage collector, until you modify > this array by triggering rb_ary_store method, for example. > Would this help? class Array alias rb_ary_shift shift def shift @len ||= length @shift_count ||= 0 res = rb_ary_shift @shift_count += 1 if @shift_count >= @len / 2 @shift_count = nil @len = nil replace(dup) end res end end > -- > Kent > --- > http://www.datanoise.com >