VST2 plugin not getting "close plugin opcode" (opcode 1)
-
- KVRer
- 5 posts since 28 Mar, 2025
Hi,
I think VST2 plugins are supposed to get opcode 1 (close plugin) as a last thing, to advice them to free all its memory, yet I don't seem to be getting them. This leads to certain aspects of my plugin leaking memory & resources (e.g. I'm running some separate GUI and background threads).
Replicating the bug is easy: add a VST2 plugin to a rack and then delete it while debugging & having breakpoints to watch what opcodes are coming; opcode 1 doesn't seem to ever arrive (?).
P.S. "but VST2 is deprecated" -> VST2 is currently the only plugin format for which there is Golang libraries. We've been toying with the idea of writing Golang bindings for CLAP, but it's a decent sized mountain to climb and won't happen anytime soon. And VST3 is not a realistic option, it is even bigger mountain to bind it to a language not named C++.
I think VST2 plugins are supposed to get opcode 1 (close plugin) as a last thing, to advice them to free all its memory, yet I don't seem to be getting them. This leads to certain aspects of my plugin leaking memory & resources (e.g. I'm running some separate GUI and background threads).
Replicating the bug is easy: add a VST2 plugin to a rack and then delete it while debugging & having breakpoints to watch what opcodes are coming; opcode 1 doesn't seem to ever arrive (?).
P.S. "but VST2 is deprecated" -> VST2 is currently the only plugin format for which there is Golang libraries. We've been toying with the idea of writing Golang bindings for CLAP, but it's a decent sized mountain to climb and won't happen anytime soon. And VST3 is not a realistic option, it is even bigger mountain to bind it to a language not named C++.
- KVRAF
- 24402 posts since 7 Jan, 2009 from Croatia
Just FYI but there does seem to be a C API for VST3.
https://github.com/steinbergmedia/vst3_c_api
But CLAP should still be easier to bind to.
https://github.com/steinbergmedia/vst3_c_api
But CLAP should still be easier to bind to.
-
- KVRer
- Topic Starter
- 5 posts since 28 Mar, 2025
I know all this. But that VST3 "C api" is header file with 3497 lines of definitions, with no accompanying documentation, and all documentation and tutorials assume you're writing C++. Hard pass. Also, still salty for the dick move Steinberg did with VST2 deprecation. I have no profit to make from this hobby project, so I will never touch VST3 in any form, just out of principle.
- KVRAF
- 24402 posts since 7 Jan, 2009 from Croatia
That's all fair enough. 
- KVRAF
- 13851 posts since 24 Jun, 2008 from Europe
That's not a bug. When the user deletes a module / plugin, it is removed from the project, but it's kept alive in the undo-redo system. When you want to test the effective deletion case of your plugin then remove it from a rack followed by Project menu -> Clear Undo-Redo History.pestis wrote: Wed Apr 30, 2025 8:00 am Replicating the bug is easy: add a VST2 plugin to a rack and then delete it while debugging & having breakpoints to watch what opcodes are coming; opcode 1 doesn't seem to ever arrive (?).
If you need to do this often, you can assign a shortcut key to Clear Undo-Redo History.
