# Memory Leaks on Juce Timer Messages

**URL:** <https://forum.juce.com/t/memory-leaks-on-juce-timer-messages/6560>\
**Category:** Audio Plugins\
**Created:** [March 13, 2011, 9:29pm UTC](https://forum.juce.com/t/memory-leaks-on-juce-timer-messages/6560 "2011-03-13T21:29:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JuceProspector](https://avatars.discourse-cdn.com/v4/letter/j/eada6e/32.png) [@JuceProspector](https://forum.juce.com/u/JuceProspector)\
**Post date:** [March 13, 2011, 9:29pm UTC](https://forum.juce.com/t/memory-leaks-on-juce-timer-messages/6560/1 "2011-03-13T21:29:49Z")

</div>

When closing down a 64 bit Cubase project that is running a Juce 64 bit plugin I get the following Leaked objects message. Is this my fault? I don’t believe I ever explicitly create any messages of these kinds.

The thread ‘Win64 Thread’ (0xb88) has exited with code 0 (0x0).  
The thread ‘Win64 Thread’ (0xd90) has exited with code 1 (0x1).  
The thread ‘Juce Timer’ (0xa70) has exited with code 0 (0x0).  
\*\*\* Leaked objects detected: 2 instance(s) of class CallbackMessage  
Cubase5.exe has triggered a breakpoint  
\*\*\* Leaked objects detected: 3 instance(s) of class Message  
Cubase5.exe has triggered a breakpoint  
Detected memory leaks!  
Dumping objects -\>  
{335345} normal block at 0x000000001ED7CA40, 56 bytes long.  
Data: \< ) \> A8 29 0C F0 FE 07 00 00 01 00 00 00 CD CD CD CD  
{31678} normal block at 0x0000000018F57720, 80 bytes long.  
Data: \< \> 88 82 0B F0 FE 07 00 00 01 00 00 00 CD CD CD CD  
{31674} normal block at 0x0000000018F57440, 80 bytes long.  
Data: \< \> 88 82 0B F0 FE 07 00 00 01 00 00 00 CD CD CD CD  
Object dump complete.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [March 13, 2011, 9:33pm UTC](https://forum.juce.com/t/memory-leaks-on-juce-timer-messages/6560/2 "2011-03-13T21:33:12Z")

</div>

Yeah, this gets mentioned very often… I think I might actually just remove the leak detector from that class in the plugin build.

Because the host is in charge of the event queue, it’s quite possible that the plugin posts one of these messages, and then gets deleted before the event is delivered - so inevitably the event is lost. Not a big deal, they’re very small and only one or two will be lost each time the plugin is unloaded from memory.

---

<div class="post-metadata">

**Author:** ![JuceProspector](https://avatars.discourse-cdn.com/v4/letter/j/eada6e/32.png) [@JuceProspector](https://forum.juce.com/u/JuceProspector)\
**Post date:** [March 13, 2011, 9:45pm UTC](https://forum.juce.com/t/memory-leaks-on-juce-timer-messages/6560/3 "2011-03-13T21:45:21Z")

</div>

Again thanks for the super fast response. I will ignore the leak messages.

---

<div class="post-metadata">

**Author:** ![hybridalienrob](https://avatars.discourse-cdn.com/v4/letter/h/ecc23a/32.png) [@hybridalienrob](https://forum.juce.com/u/hybridalienrob)\
**Post date:** [April 28, 2011, 9:40pm UTC](https://forum.juce.com/t/memory-leaks-on-juce-timer-messages/6560/4 "2011-04-28T21:40:00Z")

</div>

I am getting a lot of these messages when I run my plugin in the Juce VST host. Am i not implementing some callback somewhere perhaps ?

\*\*\* Leaked objects detected: 200 instance(s) of class CallbackMessage  
Plugin Host.exe has triggered a breakpoint  
\*\*\* Leaked objects detected: 201 instance(s) of class Message  
Plugin Host.exe has triggered a breakpoint  
Detected memory leaks!  
Dumping objects -\>  
{207110} normal block at 0x065A1288, 56 bytes long.  
Data: \< \> 94 85 8D 05 CD CD CD CD 01 00 00 00 CD CD CD CD

etc  
I’m not knowingly using the CallbackMessage anywhere in my code. How can I determine which object these callback messages are related to ?

Thanks  
Rob

---

<div class="post-metadata">

**Author:** ![ckk](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@ckk](https://forum.juce.com/u/ckk)\
**Post date:** [April 29, 2011, 5:35am UTC](https://forum.juce.com/t/memory-leaks-on-juce-timer-messages/6560/5 "2011-04-29T05:35:53Z")

</div>

I’m not using the latest tip but I don’t think this is something in the framework. I think I had something similar once but can’t recall what it was that leaked.

I’m not sure, whether this is the best way, but what I do is removing components/objects (with tags like "//LEAKTESTSLIDER1 " that can be undone easily with a replace) until the leak dissapears. Best to start with the editor (return false in hasEditor() and 0 in createEditor()).

Chris

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 29, 2011, 7:50am UTC](https://forum.juce.com/t/memory-leaks-on-juce-timer-messages/6560/6 "2011-04-29T07:50:29Z")

</div>

I’d expect to see a couple of undelivered messages get leaked sometimes, but 200 is a bit much! Sounds like you might be leaking them in your own code, or maybe you have a huge number of AsyncUpdater objects constantly pumping out these messages?
