The garbage collection has undergone a number of changes since ruby 2 was released in 2013.
Ruby garbage collection force.
This post focuses on the latest released version of cruby which is 2 7.
Schneeman has some other examples of this vulnerability in his post about symbol garbage collection in ruby 2 2.
How does garbage collection work in ruby.
Tuning approaches lourens wrote this on feb 20th 2015 9 19 am mri maintainers have put a tremendous amount of work into this is the den a publication crafted by the friendly cubs at bear metal.
Ruby s garbage collection is only concerned with ruby objects.
Ruby like most other modern high level programming languages doesn t force you to manage memory this feature is called garbage collection or gc and you get it for free in ruby.
The json gem suffered from this vulnerability before ruby 2 0 0 and mr.
Generational garbage collection was introduced in ruby 2 1.
Illustration of using write barrier to add object e to the remember set.
These include a generational garbage collector introduced in ruby 2 1 incremental garbage collection in 2 2 and compaction in 2 7.
For instance the following function will cause a memory leak even if ruby is running.
Ruby now garbage collects dynamically generated symbols so this vulnerability isn t an issue in the latest versions of ruby but older versions are common.
To preserve backward compatibility with old c extensions ruby.