    /// Free the {{ service_name }} instance.
    pub fn deinit(self: *{{ service_name }}) void {
        if (self.owner) |owner_ptr| {
            c.{{ free_fn }}(@ptrCast(owner_ptr));
            self.owner = null;
        }
    }
