GC FAQ
          nari/Narihiro Nakamura/
                         @nari_en
         Network Applied Communication
                         Laboratory Ltd.
GC FAQ                            Powered by Rabbit 0.9.3
Q: What do
 you think
about REE?
A: Totally
 awesome
approach!
But, REE
is based on
Ruby 1.8.7.
And, Ruby1.9's
 GC has many
 cool features.
Features of Ruby 1.9 series

         ✓ Suppression of Fragmentation -
           since 1.9.1
         ✓ GC::Profiler - since 1.9.1
         ✓ LazySweepGC - since 1.9.3
         ✓ GC tuning params - since 1.9.3
                                                       5/51
GC FAQ                                      Powered by Rabbit 0.9.3
GC tuning
 params
GC tuning params
         ✓ You can tune GC by using
           environment variables.
           ✓ RUBY_GC_MALLOC_LIMIT
           ✓ RUBY_HEAP_MIN_SLOTS
           ✓ RUBY_FREE_MIN

         ✓ Since Ruby 1.9.3
                                                 7/51
GC FAQ                                Powered by Rabbit 0.9.3
GC tuning params
         ✓ It's originally and idea from REE.
           ✓ <URL:http://
             www.rubyenterpriseedition.com/
             documentation.html#_garbage_collector
             _performance_tuning>

         ✓ Please check this page if you are
           interesting.
                                                         8/51
GC FAQ                                        Powered by Rabbit 0.9.3
BTW, REE
 adopts the
  Bitmap
Marking GC.
REE's Bitmap Marking

         ✓ It's implemented on Ruby 1.8's
           heap structure.
         ✓ To port it for Ruby 1.9 would be
           hard.
           ✓ And, it would be slow.

                                                     10/51
GC FAQ                                      Powered by Rabbit 0.9.3
I want to
create a faster
    Bitmap
Marking GC.
For Ruby
 1.9.4 or
  later.
Q: What do
think about the
   future of
 CRuby's GC?
A: We need to
      break
compatibility with
   CRuby's C
   extension.
We need efficient GC
                 algorithms

         ✓ Generational GC
         ✓ Incremental GC
         ✓ Concurrent GC

                                             15/51
GC FAQ                              Powered by Rabbit 0.9.3
But...
No pain,
No gain
Pains
         ✓ These algorithms need a write
           barrier.
         ✓ We should insert a write barrier
           on the C extension.
           ✓ This breaks compatibility of the C
             extension.

                                                           17/51
GC FAQ                                            Powered by Rabbit 0.9.3
I'll create
some tools for
the transition.
I'm still
thinking about
 how to do it.
Q: Why do
 you like
   GC?
A: I'm
not sure...
Paul
Graham
 says
"Beating the
  Averages"
     http://www.flickr.com/photos/ringai/2733018174/
But, I
believe
"Beaten by the
    Averages"
       http://www.flickr.com/photos/ringai/2733018174/
For
example,
  GC!!
GC is good
scapegoat.
e.g.

         ✓ "Memory isn't freed!"
           ✓ "The cause is GC!"

         ✓ "My program is slow!"
           ✓ "The cause is GC!"


                                            28/51
GC FAQ                             Powered by Rabbit 0.9.3
e.g.


         ✓ "SEGV!!"
          ✓ "GC!"



                                      29/51
GC FAQ                       Powered by Rabbit 0.9.3
GC is
  always
picked on.
In
RubyKaigi2010,
 Chad Fowler
    says
"You're not Garbage
Collector"
GC is
   always
picked on :P
But, GC was
made by really
cool hackers.
For
example,
John McCarthy




                http://www.flickr.com/photos/null0/272015955/
He created the
Mark & Sweep
 algorithm on
     Lisp.
Marvin L. Minsky




           taken by Bcjordan : http://en.wikipedia.org/wiki/File:Marvin_Minsky_at_OLPCb.jpg
He created the
 Copying GC
  algorithm.
Edsger Wybe
Dijkstra



              photo 息2002 Hamilton Richards : http://userweb.cs.utexas.edu/users/EWD/
He created
 Tri-color
marking.
Donald Ervin
Knuth



         Flickr user Jacob Appelbaum : http://flickr.com/photos/ioerror/56359970/in/set-1220741/
He created
 Lisp2(one of
Mark Compact
 algorithms).
And many
other hackers
have studied
    GC.
That means
   GC is the
training school
  of Hackers!
I think..
Become stronger by being beaten!
Let's become
stronger by being
  beat together
    with GC.
The
goal is ...
Punch-drunken
master!
Let's train
   in GC
since now!!

GC FAQ