Finding a Ruby memory leak using a time analysis

When developing a program in Ruby, you may sometimes encounter a memory leak.
For a while now, Ruby has a facility to gather information about what objects are laying around:
ObjectSpace.

There are several approaches one can take to debug a leak. This discusses a time-based approach, where
a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up.
Afterwards, one can look at all the objects, and find out which ones are staying around, causing the

OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...

I've already asked on IRC and no one seemed to have an idea why the following is happening:

I can consistently get the RubyMotion runtime and the device to freeze when running this simple code (https://gist.github.com/2936457) with rake device and then hitting the Cancel button on the UIImagePicker. I am guessing this is related to callbacks in general, but I couldn't come up with a simpler example.

As you can see, the UIImagePicker callback method simply uses each to iterate over an array of strings, but as soon as it hits the syntax error on line 28 (putd) it stops. No exception in the logs, nothing. The process has to be killed to exit it.

Any ideas? Am I supposed to release/retain something? I know blocks are a bit tricky but I can't figure out what could possibly be causing the freeze, even if it was a NULL pointer or a missing reference