Symbol
s in MRI Ruby, Round 2MRI Ruby 2.2.0
was officially released around Christmas in 2014. Back then, I ran a few memory benchmarks to test out one of the major new features: Garbage Collectable Symbol
s. Unfortunately, I found that the feature didn’t work, but couldn’t explain why. Maybe a bug in the newly released Ruby 2.2.0
?
A couple of days ago, I found my old benchmarking code again and decided to run it again. Ruby 2.6.3 has been released a month ago or so, but did anything change over time as far as the memory situation around Symbol
s is concerned?
Here is the result (x-axis = number of requests, y-axis = megabytes of memory consumption):
The employed benchmark methodology is exactly the same as in my previous article. As you can see, memory consumption in Ruby 2.1.10
and 2.2.0
is quickly increasing over time, because there is no Garbage Collection of Symbol
s, even though Ruby 2.2.0
should have it based on the official Release Notes. By now this bug is fixed. Specifically, all Ruby versions >= 2.2.10
are performing the expected Gargabe Collection of Symbol
s, which explains why memory consumption hovers around 30 MB.