What is the function of garbage collection in Ruby on Rails?

What is the function of garbage collection in Ruby on Rails?



-Garbage collection allows the removal of the pointer values that is left behind when the execution of the program ends.

-It frees the programmer from tracking the object that is being created dynamically on runtime.

-It provides a provision to remove the inaccessible objects from the memory and frees it so that other processes can use it.

-Garbage collection is used as:
x = Object.new
# this object is in use and it is residing in the memory. If it is not used then the status says
x = nil
# this means that the object can be removed from the memory and the memory can be freed for the other processes to run.
Post your comment