From: "Jesús Gabriel y Galán" Date: 2010-02-16T01:50:57+09:00 Subject: Re: Parallel assignments vs. Serial assigments 2010/2/15 Jesús Gabriel y Galán : > I think it might be because the parallel assigment creates an array > under the hood? > > class One > >  def initialize(first_name, last_name) >   @first_name = first_name >   @last_name  = last_name >  end > > end > > class Two > >  def initialize(first_name, last_name) >   @first_name, @last_name = first_name, last_name >  end > end > > class Three > >  def initialize(*args) >   @first_name, @last_name = *args >  end > end I have a class Three cause I was also testing this other form, which also creates arrays: GC.disable puts "Arrays before serial: #{ObjectSpace.each_object(Array){}}" 10000.times { |n| var = One.new("gavin#{n}", "morrice")} puts "Arrays after serial: #{ObjectSpace.each_object(Array){}}" 10000.times { |n| var = Two.new("gavin#{n}", "morrice")} puts "Arrays after parallel: #{ObjectSpace.each_object(Array){}}" 10000.times { |n| var = Three.new("gavin#{n}", "morrice")} puts "Arrays after parallel with array: #{ObjectSpace.each_object(Array){}}" $ ruby test_parallel_assignment.rb Arrays before serial: 3589 Arrays after serial: 3589 Arrays after parallel: 13589 Arrays after parallel with array: 23589 Jesus.