Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ruby 2.1.1 introduces a new environment variable, RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR, that helps to mitigate the heap growth caused by the generational garbage collector added in 2.1. By setting this variable to a value lower than the default of 2 (we are using the suggested value of 1.3) you can indirectly force the garbage collector to perform more major GCs, which reduces heap growth.

See https://bugs.ruby-lang.org/issues/9607 for more information.



This needs to be upvoted more. We went through similar pains when upgrading rather big app to Ruby 2.1.1 and setting RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR value to 1.3 did help reduce memory usage of Unicorn workes by almost 100MB.

I am not saying this is actual fix and I would like to hear from OP if he tried this environment variable and if it had any impact.

TL;DR New generational garbage collector of Ruby has some issues and ruby-core is working to fix it.


We're using this & found it works well at slowing down heap growth however we still end up with the same maximum memory usage as before, it just takes longer to get there.


Yes, exactly. You're changing the slope of the growth, but the growth still happens.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: