Issue #9137 has been reported by sam.saffron (Sam Saffron).

----------------------------------------
Bug #9137: RUBY_FREE_MIN is not enforced correctly
https://bugs.ruby-lang.org/issues/9137

Author: sam.saffron (Sam Saffron)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: 2.1.0
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


At the moment setting RUBY_FREE_MIN does not work as expected:

All it does is cause heap_set_increment to be triggered more aggressively. heap_set_increment totally ignores it. The end result is 


sam@ubuntu:~/Source/ruby$ RUBY_FREE_MIN=$(( 408*1000 )) ruby -e "GC.start; p GC.count; (800*408).times{ '' }; p GC.count"
5
12

So the GC ran 7 times even though we *should* have heap space to fit the free min. 

With this patch: https://github.com/SamSaffron/ruby/commit/b84e11c85b9fcde65dfc9347427e720307ef5a62 we can correct the behavior

sam@ubuntu:~/Source/ruby$ RUBY_FREE_MIN=$(( 408*1000 )) ruby -e "GC.start; p GC.count; (800*408).times{ '' }; p GC.count"
5
5






-- 
http://bugs.ruby-lang.org/