Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Evolution of GC in CRuby (MRI)

Evolution of GC in CRuby (MRI)

GC is with us from the beginning but it's getting harder and harder to notice with every release. I'm going to talk about shortly the problems of the past implementations and what improvements can we expect in this area.

Balazs Varga

March 25, 2015
Tweet

Other Decks in Programming

Transcript

  1. 1.9.3 - Lazy sweep The issue and the whole discussion

    is in Japanese… https://bugs.ruby-lang. org/issues/3203 Source: [1]
  2. 2.0 - Bitmap Marking GC • The mark phase is

    rewritten to be non-recursive • Bitmaps for COW safety • COW: Copy On Write
  3. 2.0 - Bitmaps for COW safety The Ruby heap contains

    RValue objects (RString, RHash, parsed code - AST node objects). Source: [2]
  4. 2.1 - RGenGC Oldgen and minor marking • generational collector,

    implemented incrementally • supports C-extensions (backward compatibility) Source: [1]
  5. 2.1 - RGenGC Oldgen and minor marking • New options

    for GC tuning • https://tunemygc.com anyone? Source: [1]
  6. 2.1 - RGenGC Oldgen and minor marking Ruby 2.1 ships

    with new tracepoints that can be used to monitor the GC at runtime. Source: [3]
  7. 2.1.1 - “bug” in RGenGC Source: [4] “If ever an

    objects survives a minor GC it will be flagged as oldgen, these objects will only be scanned during a major GC.” Fixed in 2.1.2, 2.2
  8. [1]: http://tmm1.net/ruby21-rgengc/ [2]: http://patshaughnessy.net/2012/3/23/why-you-should-be-excited-about-garbage-collection-in- ruby-2-0 [3]: http://tmm1.net/ruby21-oobgc/ [4]: http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-ready-for-production [5]:

    https://engineering.heroku.com/blogs/2015-02-04-incremental-gc [6]: http://www.iecc.com/gclist/GC-algorithms.html [7]: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/68630 Resources