Large increase in free memory slots after upgrading Rails app to Ruby 2.6.1

Hoping to direct some people to this question on StackOverflow: Why might average free memory slots dramatically increase after upgrading to Ruby 2.6? - Stack Overflow

After upgrading to Ruby 2.6.1 I noticed a large increase in free memory slots with a consistent pattern for them tapering off (graphs in StackOverflow question). I don’t notice and performance impact, but interested in why it might be happening.

Thanks!

Do you have JIT enabled or not? There's a lot of potential for JIT, but it is very experimental for now, and not so good for Rails yet. Otherwise it sounds like a garbage collection (GC) issue.

I would recommend reading this:

There's some good stuff there on how to bench and tune things (albeit, slightly out of date).

A few simple examples is to use direct SQL queries when possible instead of full model loads, and using the BANG (!) methods when possible (in other words, using, say "reject!" instead of "myvar = myvar.reject ...")

Hope this helps.

Phil