-
-
Notifications
You must be signed in to change notification settings - Fork 188
Description
When removing/destroying an instance of a VST3/CLAP plugin made with nih-plug
(using nih-plug-egui
for the UI) inside a host DAW, the plugin's drop glue consistently fails to run. After some debugging, I was able to track this down to an incorrect Arc
refcount in the wrapper code. This leaks an arbitrary amount of memory every time - in the case of my own sampler plugin, anywhere up to hundreds of megabytes.
Tested on FL Studio 2024 and Reaper v7.40 using VST3 and CLAP. Both print an equivalent nih_debug_assert_eq!()
failure:
VST3: Debug assertion failed: Arc::strong_count(&self.inner) != 1
inside <Vst3Wrapper as Drop>::drop(&mut self)
CLAP: Debug assertion failed: Arc::strong_count(&this) != 1
inside unsafe extern "C" fn destroy(plugin: *const clap_plugin)
In the case of CLAP, I was able to check the refcount at the point of the assertion failure:
The problem still occurs if the plugin window is never opened.