extism / ruby-sdk

Extism Ruby Host SDK - easily run WebAssembly modules / plugins from Ruby applications
https://extism.org
BSD 3-Clause "New" or "Revised" License
10 stars 1 forks source link

fix: call `extism_function_free` for functions created with `extism_function_new` #14

Closed zshipko closed 11 months ago

zshipko commented 11 months ago

Fixes #12

Adds calls to free functions associated with a plugin when the plugin gets cleaned up, or if plugin initialization fails.

Not sure if this is the most idiomatic way to handle this, so if there's a better way to do this let me know!

zshipko commented 11 months ago

Actually, I'm don't think this is the right solution after looking at the code a little more. It seems like a Extism::HostEnvironment could be used to make multiple plugins so the functions need to be freed when the Extism::Function or Extism::HostEnvironment get garbage collected.