Hi, I''ve described a problem with the implementation of Array shift in Ruby 1.8.4 here: <http://recursive.ca/hutch/index.php?p=361> I believe that this is the source of the problem Mongrel had experienced with the Mutex and a memory leak. I''ve described a possible (single line) solution to this in the article. What I am not completely sure of is what the intended semantics of shift actually is, consequently the suggested fix may be inappropriate. I''ll leave that to someone else to decide. Cheers, Bob ---- Bob Hutchison -- blogs at <http://www.recursive.ca/ hutch/> Recursive Design Inc. -- <http://www.recursive.ca/> Raconteur -- <http://www.raconteur.info/> xampl for Ruby -- <http://rubyforge.org/projects/xampl/> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
On 23-Sep-06, at 8:41 PM, Bob Hutchison wrote:> > Hi, > > I''ve described a problem with the implementation of Array shift in > Ruby 1.8.4 here: > > <http://recursive.ca/hutch/index.php?p=361> >The following illustrates the problem on OS X (and I believe linux) accumulator = [] first = true 10.times do |i| a = [] a << "!" * 10000000 #a[0] = nil a.shift accumulator << a GC.start stdout = `ps v -p #{ Process.pid }` stdout = stdout.split(%r/\n/) printf("\n %s\n", stdout.first) if first printf("%6d:: %s\n", i, stdout.last) first = false end --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
On Sat, 23 Sep 2006 20:41:14 -0400 Bob Hutchison <hutch@recursive.ca> wrote:> > Hi, > > I''ve described a problem with the implementation of Array shift in > Ruby 1.8.4 here: > > <http://recursive.ca/hutch/index.php?p=361> > > I believe that this is the source of the problem Mongrel had > experienced with the Mutex and a memory leak. >Kirk had mentioned something along these lines but this is the first explanation that also shows where in the C code it''s busted. Ok, but here''s the problem, doesn''t this also mean that the shifted array continually grows? It seems to me that shift basically makes Array act like an unbounded ring buffer. Hopefully this gets fixed in ruby very very soon. -- Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---