I am new to Ruby. If I instantiate an object instance with
x = Foo.new
should I set x to nil to free the object instance when it is no longer needed?
Can anyone point me to any articles etc. on memory management in Ruby?
Thanks.
I am new to Ruby. If I instantiate an object instance with
x = Foo.new
should I set x to nil to free the object instance when it is no longer needed?
Can anyone point me to any articles etc. on memory management in Ruby?
Thanks.
If you set x to nil, the garbage collector can free the memory because
there is not a reference to this area.
Bazsl wrote:
I am new to Ruby. If I instantiate an object instance with
x = Foo.new
should I set x to nil to free the object instance when it is no longer needed?
Can anyone point me to any articles etc. on memory management in Ruby?
Thanks.
For the most part you don't need to worry about memory management in Ruby. When there are no more references to an object, Ruby's garbage collector will collect the object and make its storage available for re-use.
If you want to know more, here's a good article: http://whytheluckystiff.net/articles/theFullyUpturnedBin.html\.
--
RMagick OS X Installer [http://rubyforge.org/projects/rmagick/\]
RMagick Hints & Tips [http://rubyforge.org/forum/forum.php?forum_id=1618\]
RMagick Installation FAQ [http://rmagick.rubyforge.org/install-faq.html\]