I'm looking at moving to using static linking for the Microsoft C Run Time lib in my plug-in, so that I can avoid any potential DLL versioning issues (DLL hell, as it's sometimes referred to). This all seems to work fine except that I noticed when I'm debugging my plug-in with the Juce Plug-in Host I get an exception is thrown in HeapFree when the Plug-in Host is being shut down for the VST2 version. For the VST3 version I get a whole bunch of memory leak errors.
I've also been able to reproduce this bug with the Juce Demo Plug-in (sources are about 1 month behind the tip), but I have to make sure that the Plug-In Host is built with a different version of Visual Studio (actually the platform toolset). This sounds like a problem where a memory deallocation is occurring from a different version of the CRT than the same memory was allocated from.
This problem doesn't seem to happen with the 3 other hosts I tried (Cubase, Studio One and PT), so maybe I could just live with the bug. But I am concerned that I might have some lurking issue which will show up in other hosts from time to time. And of course it would be nice to not hit all of these expectations when I'm debugging.
Any ideas what's going on exactly and how to fix this bug?