First page Back Continue Last page Overview Text

Notes:


Leaking memory in C extensions is very easy. Here's a simple example, where you want to take a C string and create a ruby string from the first three characters.

This leaks because strndup calls malloc, which allocates new memory, but the returned value is passed to rb_str_new2 and never freed.