void rbffi_MethodHandle_Free(MethodHandle* handle) { if (handle != NULL) { rbffi_Closure_Free(handle->closure); } }
static void function_free(Function *fn) { if (fn->methodHandle != NULL) { rbffi_MethodHandle_Free(fn->methodHandle); } if (fn->closure != NULL && fn->autorelease) { rbffi_Closure_Free(fn->closure); } xfree(fn); }
static VALUE function_release(VALUE self) { Function* fn; Data_Get_Struct(self, Function, fn); if (fn->closure == NULL) { rb_raise(rb_eRuntimeError, "cannot free function which was not allocated"); } rbffi_Closure_Free(fn->closure); fn->closure = NULL; return self; }