vst-rs icon indicating copy to clipboard operation
vst-rs copied to clipboard

Preventing memory leak when plugin is unloaded

Open Boscop opened this issue 7 years ago • 3 comments

We are using Box::into_raw in VSTPluginMain but when a plugin is unloaded in a host, how will the memory get freed? How are hosts usually freeing the memory when unloading a vst dll? Are hosts usually calling delete aeffect; on the pointer returned by VSTPluginMain (assuming that they were written in C++)? Or are they not even trying to free the memory?

It might not happen often that plugins are unloaded/reloaded but we should still strive to avoid memory leaks..

Boscop avatar Apr 22 '18 23:04 Boscop

We may need to manage a static pool of plugin instances from within the lib and clean up the memory when the host notifies us before destruction. (Which I think they are supposed to do)

zyvitski avatar Apr 25 '18 23:04 zyvitski

How does the host notify the plugin?

Boscop avatar Apr 26 '18 07:04 Boscop

@Boscop via Shutdown opcode. It seems like it's already implemented, so this issue can be closed.

inikulin avatar Jan 02 '20 13:01 inikulin