dpaluy dpaluy - 4 years ago 245
Ruby Question

What is the difference between `RUBY_GC_OLDMALLOC_LIMIT` and `RUBY_GC_MALLOC_LIMIT`?

Why does Ruby MRI 2.1 define both

? What is the difference?

Answer Source

Here's a great resource to explain this concept.

In brief, the reason there are two MALLOC_LIMIT variables is that Ruby 2.1 has moved to a two-generation garbage collector. When the memory footprint of newer high-turnover objects on the heap reaches the RUBY_GC_MALLOC_LIMIT, it triggers a minor GC event; when the size of longer-lived objects reaches RUBY_GC_OLDMALLOC_LIMIT, a major GC event is triggered.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download