代码之家  ›  专栏  ›  技术社区  ›  glebm

Ruby垃圾收集堆槽大小

  •  5
  • glebm  · 技术社区  · 15 年前

    因此,ruby企业文档声明GC设置中的所有值都是在slot中定义的: http://www.rubyenterpriseedition.com/documentation.html#_garbage_collector_performance_tuning

    (例如RUBY_HEAP_MIN_插槽)

    我们微调了应用程序的最小插槽大小和增量,通过反复试验获得最佳性能(我们有足够的机器来了解不同的值如何影响malloc调用和完整gc的数量)。

    4 回复  |  直到 15 年前
        1
  •  3
  •   Alice    15 年前
    $ rvm use ruby-1.9.2-p136
    $ gdb ruby
    (gdb) p sizeof(RVALUE)
    $1 = 40
    
        2
  •  4
  •   Sam Saffron James Allen    13 年前

     *  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
    
        3
  •  1
  •   rogerdpack    15 年前

    1.9中的默认值是8K

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

    请注意,每当空间用完需要重新分配时,在1.9中,它会以指数形式分配更多的堆。

    在1.8中,它将分配越来越大的堆。

        4
  •  1
  •   glebm    15 年前

    1 slot 尺寸是 sizeof(struct RVALUE) ,这取决于机器。

    推荐文章