Memory leak calling setStateInformation() on hosted VST3 plugin

I’m writing a plugin-host program, and I’ve found that on Windows (10, 64-bit) calling setStateInformation() on an AudioPluginInstance which wraps a VST3 plugin seems to leak 4.5k bytes of memory every time. VST2 plugins don’t have this issue.

Assuming this is due to a problem in my own code (which it probably is), I tried everything I could think of, but no luck. I have therefore set up a small demo project on GitHub at https://github.com/getdunne/juce-wrapper. Any assistance/advice would be hugely appreciated.

BTW I have verified that the problem persists even with JUCE v5.4.2, released only a few hours ago, and with versions 3.6.7 through 3.6.12 (latest) of the Steinberg VST3 SDK.

UPDATE: I think I found the problem, and have submitted a Pull Request https://github.com/WeAreROLI/JUCE/pull/484.

On Linux, building with address sanitizer (-fsanitize=address) will enable leak checking. That’s how I’d start debugging this issue, assuming you can build your program on Linux.

Just reread your post - does it only leak on Windows?

Linux probably doesn’t help much when it’s about hosting a 3rd party VST plugin. Very few of those available for Linux…

Nothing to stop you building one of the juce demo plugins as a vst3 and using that for testing.

I already did that before posting, and I’ve tested with commercial VST3 plug-ins as well. All have the same issue.