Timer memory leak?


this may not necessarily be a JUCE bug, I may as well be doing something wrong, so I just need a second opinion.

Sometimes (seems like 50:50) when I close my application I get the following output in Visual Studio:

Detected memory leaks!
Dumping objects ->
{3576} normal block at 0x04D79FA0, 8 bytes long.
 Data: < D      > C0 44 DE 01 01 00 00 00 
Object dump complete.

When I set a breakpoint to that allocation ID (3576) it leads to Timer::run method, where the second line of the function creates an instance of the CallTimersMessage. That is this line:

MessageManager::MessageBase::Ptr messageToSend (new CallTimersMessage());

JUCE leak detector assert has no problem with that, but the Visual Studio CrtDbg library reports it.

I guess it’s no big deal, as there always seems to be just one leaked instance but I’d still like to know what’s the problem.

I found this thread, which may be related, but I cannot make much out of it - my application is no plugin. Just a simple GUI application with several GUI elements.



This is as far as I know expected behaviour for JUCE, and was recently discussed also in a previous thread.

As you see it is most likely messages left in the queue on shutdown that are leaked.


Hi, thanks for the link and the explanation. It also explains why it happens only sometimes (roughly 50% as I said).