Could this generate memory leakage?

Could this potentially generate memory leakage?

      def save_weights(error)
        best_error = error
        best_weights = Marshal.load(Marshal.dump(weights))
      end

This code runs several 1000s of times, making a copy of the best
configuration for a network. best weights always points at the copy of
best weights.. but I don't know what happens to the other copies that
are no longer being pointed at. Ruby does garbage collection, right?

Ted.

···

--
Posted via http://www.ruby-forum.com/.

Yeah, no problems with that.

···

On Tue, Nov 30, 2010 at 9:16 AM, Ted Flethuseo <flethuseo@gmail.com> wrote:

Could this potentially generate memory leakage?

 def save\_weights\(error\)
   best\_error = error
   best\_weights = Marshal\.load\(Marshal\.dump\(weights\)\)
 end

This code runs several 1000s of times, making a copy of the best
configuration for a network. best weights always points at the copy of
best weights.. but I don't know what happens to the other copies that
are no longer being pointed at. Ruby does garbage collection, right?

--
Michael Fellinger
CTO, The Rubyists, LLC