Skip to content

Fix reference cycles in VST3/CLAP wrappers - #225

Open
estroBiologist wants to merge 3 commits into
robbert-vdh:masterfrom
estroBiologist:master
Open

Fix reference cycles in VST3/CLAP wrappers#225
estroBiologist wants to merge 3 commits into
robbert-vdh:masterfrom
estroBiologist:master

Conversation

@estroBiologist

Copy link
Copy Markdown

This PR resolves #222, which was caused by the execute_background and execute_gui callbacks both receiving a strong clone of their parent wrappers' Arcs, leading to a reference cycle.

I've gone for the most obvious fix in this situation - just downgrade the Arcs before moving them into their respective callbacks, and ignore any tasks posted after the wrappers have been dropped. I've confirmed that this resolves the memory leak (and the subsequent VST3 crash in FL Studio), and I haven't noticed any issues caused by dropping the tasks -- though please correct me if I'm wrong on that.

@JuxGD

JuxGD commented Sep 21, 2025

Copy link
Copy Markdown

How are you building the plugins? I tried building spectral_compressor with cargo xtask bundle spectral_compressor --release --target=x86_64-pc-windows-gnu (cross compiling to windows from linux) and the FL Studio freeze still happens in my Windows 11 VM

(edit) Nevermind, I ended up compiling it from within the VM (tried x86_64-pc-windows-gnu and x86_64-pc-windows-msvc) and it's the same thing 😭, it doesn't seem to fix the issue for me

(edit 2) I just realized there's a possibility that I may be compiling it wrong still

@JuxGD

JuxGD commented May 14, 2026

Copy link
Copy Markdown

Hey just commenting here, as we know Robbert hasn't been maintaining NIH-plug very much, which is why the "maintenance mode" disclaimer thingy in the README has been there, but somehow I never noticed that there's a seemingly actively maintained fork linked in the same disclaimer

Check it out https://codeberg.org/BillyDM/nih-plug

Sooo check if maybe that version already has your fixes, and if it doesn't it might be worthwhile to open a pull request there

@JuxGD

JuxGD commented May 14, 2026

Copy link
Copy Markdown

Just quickly comparing the corresponding files and it seems the fork might have your fixes applied already? If it does, it's implemented a bit differently using match instead of if (might be wrong lol im not a rust pro)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VST3/CLAP wrappers fail to call their internals' drop glue when destroyed

2 participants