could this generate memory leakage?

T

Ted Flethuseo

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.
 
M

Michael Fellinger

Could this potentially generate memory leakage?

=C2=A0 =C2=A0 =C2=A0def save_weights(error)
=C2=A0 =C2=A0 =C2=A0 =C2=A0best_error =3D error
=C2=A0 =C2=A0 =C2=A0 =C2=A0best_weights =3D Marshal.load(Marshal.dump(wei= ghts))
=C2=A0 =C2=A0 =C2=A0end

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?

Yeah, no problems with that.


--=20
Michael Fellinger
CTO, The Rubyists, LLC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top