Rubbish Rubbish Size

So, the documentation for Ruby Enterprise indicates that all values ​​in the GC settings are defined in the slots: http://www.rubyenterpriseedition.com/documentation.html#_garbage_collector_performance_tuning

(e.g. RUBY_HEAP_MIN_SLOTS)

We filter the application size and the minimum application size for maximum performance by trial and error (we have enough machines to get an idea of ​​how different values ​​affect the number of calls to malloc and Full GCs).

But something distorted me for a while: how big is 1 slot in bytes?

+5
source share
4 answers
$ rvm use ruby-1.9.2-p136
$ gdb ruby
(gdb) p sizeof(RVALUE)
$1 = 40
+3
source

From Ruby source:

 *  sizeof(RVALUE) is
 *  20 if 32-bit, double is 4-byte aligned
 *  24 if 32-bit, double is 8-byte aligned
 *  40 if 64-bit
+4

1.9 - 8K

http://svn.ruby-lang.org/repos/ruby/trunk/gc.c ( HEAP_SIZE)

Note that whenever it runs out of space and requires redistribution, in 1.9 it allocates exponentially more heaps.

In 1.8, he would allocate large and large heaps.

+1
source

After diggin 'through the code:

1 slot- The size sizeof(struct RVALUE), which depends on the machine.

+1
source

All Articles