I remember when writing my first few ruby C extensions, I had a lot of problems with memory leaks.
I decided to take an approach to memory management in home_run that made it so that I never had to worry about leaking memory.