Many people experienced issues with memory usage when switching their Rails app from Ruby 2.0 to Ruby 2.1 on Heroku. For example, see Memory usage increase with Ruby 2.1 versus Ruby 2.0 or 1.9. Are these issues resolved with Ruby 2.2?
-
2I tested this yesterday. Our apps performed far worse with 2.2 than 2.1 - in fact our worker instances doubled their memory usage. – RLT Dec 31 '14 at 22:48
-
2.2 worked for others: http://stackoverflow.com/questions/27102565/memory-usage-increase-with-ruby-2-1-versus-ruby-2-0-or-1-9 – user1322092 Feb 06 '15 at 01:43
3 Answers
I gave Ruby 2.2 a try with Rails 4.2 and the same memory problems that plagued Ruby 2.1 also occurred. I am switching back to Ruby 2.0. Rails 5 will require Ruby 2.2 and higher so I hope someone will find a way to fix this.

- 3,144
- 4
- 26
- 30
-
I had the same issue..with 2.2.1...95% memory usage. Downgrading to 2.0.0 – justcode Jul 24 '15 at 16:51
We tried Ruby 2.2.2 on Heroku's Cedar-14 stack, 2X dynos, even reducing Unicorn workers from 5 to 3, and still had memory hover near the 1GB maximum within a few hours of moderate web traffic, and swap size jumped to 200MB - 300MB.

- 18,697
- 25
- 111
- 187
Ruby 2.2-2.3 introduced another bug for multithreaded C-based ruby installations https://evilmartians.com/chronicles/ruby-2_2-oom,
basically, if stars align badly the GC turns off :P and with some sites stars align badly couple times a day, we still use Ruby 2.0 and are waiting for 2.3.5 for the fix from the blog to come out

- 7,075
- 3
- 30
- 56
-
-
2Not yet, we're still on 2.0, to be honest I did not even test if something changed – bbozo May 04 '16 at 08:54
-
I was on 2.1.5 but after reading your answer to this rolled-back to 2.0 on our heroku rails app - dramatic improvement in memory usage / total resolution of previous memory errors that required a 6 hourly puma worker killing. Thanks! – djoll May 07 '16 at 01:51