Strange memory leak from MessagManager

Hello, when trying to load a plugin using this code:

    OwnedArray<PluginDescription> pluginDescriptions;
    KnownPluginList pluginList;
    AudioPluginFormatManager pluginFormatManager;
    for (int i = pluginFormatManager.getNumFormats(); --i >= 0;)
        pluginList.scanAndAddFile (String (path),

I get:
***** Leaked objects detected: 1 instance(s) of class MessageManager**

JUCE Assertion failure in juce_LeakedObjectDetector.h:90

Does someone know what can be the problem? Thanks!

Are you trying this without a GUI?
The MessageManager is a singleton, in a GUI app it will be destroyed automatically.
In a console app or anything, that doesn’t call the JUCE_START_APPLICATION (MyApp) macro,
you have to add a ScopedJuceInitialiser__GUI, that will clean up when going out of scope.

Hope that helps.


Thank you Daniel, it helps!