Most Ruby developers will spend years happily writing Ruby code without ever needing to touch native C code. But someday you might find yourself an exception to this rule. Maybe you need to add a feature to a native library binding, or even implement a new library binding from scratch. Or maybe you need to rewrite some CPU-intensive calculations in native code for performance reasons.
Whatever the reason, once you start writing C code, you’ll need to understand the Ruby C APIs for managing memory. In today’s episode, the first of a two-part series, veteran library maintainer Jeremy Evans joins us to demonstrate how to make code C extensions so that they don’t leak memory. Enjoy!