# Memory leaks detected on Windows, but not on Mac?

**URL:** <https://forum.juce.com/t/memory-leaks-detected-on-windows-but-not-on-mac/40276>\
**Category:** General JUCE discussion\
**Created:** [June 22, 2020, 5:58pm UTC](https://forum.juce.com/t/memory-leaks-detected-on-windows-but-not-on-mac/40276 "2020-06-22T17:58:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [June 22, 2020, 5:58pm UTC](https://forum.juce.com/t/memory-leaks-detected-on-windows-but-not-on-mac/40276/1 "2020-06-22T17:58:30Z")

</div>

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

```auto
{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.

---

<div class="post-metadata">

**Author:** ![matkatmusic](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@matkatmusic](https://forum.juce.com/u/matkatmusic)\
**Post date:** [June 23, 2020, 12:02am UTC](https://forum.juce.com/t/memory-leaks-detected-on-windows-but-not-on-mac/40276/2 "2020-06-23T00:02:34Z")

</div>

> [@stephenk](#):
>
> 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.

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

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

```
