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

Curious Case of Ruby's memory

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →
Hemant Kumar
September 30, 2014

Curious Case of Ruby's memory

A roundup of Ruby memory profiling and GC

Hemant Kumar

September 30, 2014

Transcript

49 slides
  1. Don’t use low level access for Ruby DS in C

    extensions, such RARRAY_PTR
  2. If your C-ext holds ref. to a Ruby object you

    need Write Barriers for taking adv. of Gen. GC.
  3. About RBKit • A low overhead Ruby Profiler built for

    MRI. • Written almost completely in C.
  4. RBKit • Gather and send all profile data via ZeroMQ

    to connected client (Desktop app) • Uses msgpack as serialization format.
  5. Advantage RBKit • ZeroMQ manages separate IO threads for sending

    and receiving messages. • Msgpack serialisation is fast. • A profiler that can be used in production!
  6. Why Qt/C++? • All heavy lifting is done client side.

    • Parsing and processing heap dump of millions of objects. • We can still render certain pages/data using plain HTML via Qt Webkit bridge.
  7. RBkit Status Report • Memory Profiling works (Demo) • CPU

    Profiling is in works. • Open source
  8. Ruby Heap vs C heap • Rvalue size = 40

    bytes • If Object can’t fit that size, ruby uses ruby_xmalloc() • which is wrapper around malloc()

More Decks by Hemant Kumar

Other Decks in Programming