On Windows, messages (i.e. MessageManager::MessageBase instances) that get posted to the system queue will leak if JUCE is shut down before they are handled.
The cause is simple: in juce_Win32_messaging.cpp, incReferenceCount() is called manually on a message when it is stuffed into an LPARAM posted to the system queue, and decReferenceCount() is called after it’s handled.If the message window is destroyed before it is handled, Windows discards the pending messages and the reference count is never decreased.
The fix is also simple. Just add a ReferenceCountedArray<MessageManager::MessageBase*, CriticalSection> to this file. Instead of manually managing the reference count, add and remove the message to/from this array. Clear the array at shutdown, just after destroying the message window.
I checked the development branch, it looks like it’s still not fixed there