title: Does this Array.new in a loop create a memory leak?
body: <p>I know how I'd do this in C++, but in Ruby, I'm not so sure. This is basically the structure that I'm working with (except that instead of integers, I have 2 element arrays contained within the array <em>data</em>.)</p>
  
  <pre><code>data = [ 1, 2, 3 ]
  
  while true do
      wrong = Array.new
      data.each do |d|
          print "Guess: "
          guess = gets
          if guess.strip.to_i == d
              puts "Correct!"
          else
              puts "Sorry, the right answer is #{ d }."
              wrong &lt;&lt; d
          end
      end
  
      if wrong.length == 0
          break
      else
          data = wrong
      end
  end
  </code></pre>
  
  <p>Am I creating a memory leak by <strong>Array.new</strong> in each loop? Is there an alternative approach that is more efficient?</p>
  
  <p>Thanks in advance!</p>