Ruby Inspect, a comprehensive review of the programming language Ruby
Ruby has the Garbage collection. Ruby’s Garbage collection uses a mark and sweep approach, in which Ruby first marks the objects that are still in use and then cleans up unmarked objects and frees the memory. Ruby does not have programmer-written manual collection and does the garbage collection automatically.
Reference:
[1] https://stackify.com/how-does-ruby-garbage-collection-work-a-simple-tutorial/ How Does Ruby Garbage Collection Work - Stackify