Ruby தன்னியக்கமாக garbage collector (GC) மூலம் மெமொரியை நிர்வகிக்கிறது, இது இனி குறிப்பிடப்படாத பொருட்களை மீட்டெடுக்கிறது. நவீன Ruby (MRI) generational, incremental mark-and-sweep collector ஐ compaction உடன் பயன்படுத்துகிறது. இது performance மற்றும் நீண்ட கால பயன்பாட்டு பயன்பாடுகளில் மெமொரி சிக்கல்களைக் கண்டறிய உதவுகிறது.
தன்னியக்க garbage collection
Ruby allocates objects on the heap; the GC reclaims those that are no longer REACHABLE
(referenced). You never free memory manually.
Modern MRI GC characteristics:
✓ Mark-and-sweep — marks reachable objects (from roots), sweeps unreachable ones
✓ Generational (since Ruby 2.1) — new objects collected often, old ones rarely
(based on "most objects die young")
✓ Incremental — spreads GC work to reduce pause times
✓ Compacting (GC.compact, Ruby 2.7+) — reduces memory fragmentation
