Memory Leaks with VSTs

When I load a VST in a tracktion engine project, I always leak memory when the project closes. I typically get something like this:

Cleaning up temp files..
*** Leaked objects detected: 1 instance(s) of class AttributeList
JUCE Assertion failure in juce_LeakedObjectDetector.h:90
*** Leaked objects detected: 1 instance(s) of class VST3HostContext
JUCE Assertion failure in juce_LeakedObjectDetector.h:90
AM_MemoryRecord closing down with 338 allocations vs 331 freed
AM_PreferencesAudio::destroy instance destroyed
AM_PreferencesAudio::~AM_PreferencesAudio(), instanceCount after destruction: 0
4 allocations left
Program ended with exit code: 0

What’s the right way to cleanup/free resources in a project with external plugins?

There was a discussion about it in this thread:

I observed the same problem, it seems only to occur when scanning a new plugin (also juce plugins IIRC.). When there was no new plugin, the leaks were gone for me.
So at least the harm it can do is very limited.

Thanks, Daniel. When you say “new plugin” do you mean the first time a plugin is loaded in a project? Or the first time a new plugin is scanned?

I’m getting leak every time a load an instance of of “U-he Zebra 2”. Weirdly, it doesn’t happen with other plugins (“NI Massive”, “NI Massive X”)

I’m pretty sure it is not my code, because it only happens with some plugins, and it is only a few lines of code.

Hello, for those having this problem, I put a answer here :