I am using GC.stat
to profile memory usage in our Rails app. GC.stat
returns a hash with the following keys:
:count
:heap_used
:heap_length
:heap_increment
:heap_live_num
:heap_free_num
:heap_final_num
Does anybody know exactly what these values mean? There's no documentation of them in the Ruby source (gc.c), just a comment: "The contents of the hash are implementation defined and may be changed in the future."
Some of these fields make sense from context, e.g. count
is the number of heaps Ruby has allocated. But what is heap_final_num
? What is heap_increment
? Is heap_length
the minimum heap size?
I'm fiddling with RUBY_MIN_HEAP_SLOTS
, RUBY_FREE_MIN
and RUBY_GC_MALLOC_LIMIT
, but changing those env vars doesn't seem to have any effect on :heap_count
or :heap_length
. I would expect that :heap_count
would go down if I radically increase min heap slots. So I really would like to know exactly what all the GC.stat
values represent!
I'm using Ruby 1.9.3.