time to bleed by Joe Damato

technical ramblings from a wanna-be unix dinosaur

Author Archive

Slides from Defcon 18: Function hooking for OSX and Linux

View Comments

Written by Aman Gupta

August 1st, 2010 at 11:24 am

EventMachine: scalable non-blocking i/o in ruby

View Comments

Written by Aman Gupta

March 12th, 2010 at 1:07 pm

Garbage Collection Slides from LA Ruby Conference

View Comments

Written by Aman Gupta

February 20th, 2010 at 3:03 pm

What is a ruby object? (introducing Memprof.dump)

View Comments

If you enjoy this article, subscribe (via RSS or e-mail) and follow me on twitter.
After Joe released memprof a few days ago, I started thinking about ways to add more functionality.

The initial Memprof release only offered a simple stats api, inspired by the one in bleak_house:

require 'memprof'
o = Object.new
      1 test.rb:3:Object

With the help of lloyd‘s excellent yajl json library, I’ve slowly been building a full-featured heap dumper: Memprof.dump.

require 'memprof'
    "address": "0xea52f0",
    "source": "test.rb:3",
    "type": "array",
    "length": 0

Where can I find it?

This new heap dumper will be in the next release of Memprof. If you want to play with it, checkout the heap_dump branch on github.

What else is planned?

Over the next few days, I’m going to add a Memprof.dump_all method to dump out the entire ruby heap. This full dump will contain complete knowledge of the ruby object graph (what objects point to other objects), and its json format will allow for easy analysis. I’m envisioning a set of post-processing tools that can find leaks, calculate object memory usage, and generate various visualizations of memory consumption and object hierarchies.

Why should I care?

In building and testing Memprof.dump, I’ve learned a lot about different types of ruby objects. The rest of this post covers interesting details about common ruby objects, with examples of how they’re created and what they look like inside the MRI VM.

Read the rest of this entry »

Written by Aman Gupta

December 14th, 2009 at 5:59 am

Debugging Ruby: Understanding and Troubleshooting the VM and your Application

View Comments

Download the PDF here.

Debugging Ruby

Written by Aman Gupta

December 2nd, 2009 at 8:30 pm