Memory leaks detected on Windows, but not on Mac?

So Visual Studio 2019 on Windows 10 shows me some memory leaks in my plugin/app, i.e:

{26997} normal block at 0x000002308FC4EFB0, 48 bytes long.
 Data: <            0   > 00 00 00 00 CD CD CD CD A8 82 C7 8F 30 02 00 00 
{26996} normal block at 0x000002308FC4F640, 48 bytes long.
 Data: <            0   > 00 00 00 00 CD CD CD CD D0 81 C7 8F 30 02 00 00 
{26995} normal block at 0x000002308FC781D0, 432000 bytes long.
 Data: <@   0       0   > 40 F6 C4 8F 30 02 00 00 E0 86 C7 8F 30 02 00 00 
Object dump complete.

Xcode on the Mac tells me nothing about this.

The leaks are correct and I fixed them. But I’d like to know:

Is there a way to get Xcode on the Mac to alert me to these?

I do have JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR in most of my JUCE classes, but these leaks were in some structs that are not declared that way.

Secondly, can anyone tell me an easy way to make a memory leak in JUCE so I can test exactly what happens with JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR ? I’ve triggered the assert in the past, but I don’t remember how and my attempts today are unsuccessful.

EDIT: Already have “Recommended Compiler Warning Flags” turned on for the Mac Debug project in Projucer.

#include <JuceHeader.h>
struct Foo
{
   JUCE_LEAK_DETECTOR(Foo)
};

int main( /* const char/argc stuff here */ )
{
   Foo* foo = new Foo();
   return 0;
}
1 Like