Garbage collection is the process of reclaiming the memory space. Ruby avoids memory leaks at a great extent. Ruby performs garbage collection automatically. The memory resource management for allocation and deallocation is not hard coded. Dynamic storage space allocation in the memory space is done there by avoiding scores of application crashes.