*** Leaked objects detected: 1 instance(s) of class TimerThread

We’re running Tracktion Engine as a Framework without GUI om macOS. When closing the app using the macOS Framework, we get a bunch of leaks, see below. We use RAII and no new or delete as far as I can see. When debugging it seems like the TimerThread has something to do with the settings file Settings.xml!?
Is it normal to get these leaked objects at program shutdown?
If not, any hints?
Thanks!

DLSSynth::deinitialise
DLSSynth::deinitialise
DLSSynth::~DLSSynth
DLSSynth::~DLSSynth
DLSSynth::~DLSSynth
DLSSynth::~DLSSynth
DLSSynth::~DLSSynth
closing MIDI output: Tracktion MIDI Device
Cleaning up temp files..
*** Leaked objects detected: 1 instance(s) of class TimerThread
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
*** Leaked objects detected: 1 instance(s) of class Thread
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
*** Leaked objects detected: 3 instance(s) of class WaitableEvent
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
*** Leaked objects detected: 1 instance(s) of class PropertiesFile
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
*** Leaked objects detected: 1 instance(s) of class PropertySet
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
*** Leaked objects detected: 8 instance(s) of class AudioBuffer
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
*** Leaked objects detected: 1 instance(s) of class BufferList
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
*** Leaked objects detected: 1 instance(s) of class OwnedArray
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
*** Leaked objects detected: 1 instance(s) of class SelectableUpdateTimer
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
*** Leaked objects detected: 3 instance(s) of class AsyncUpdater
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
*** Leaked objects detected: 1 instance(s) of class MessageManager
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
JUCE Assertion failure in juce_Singleton.h:50
JUCE Assertion failure in juce_Singleton.h:50
*** Leaked objects detected: 1 instance(s) of class StringPairArray
JUCE Assertion failure in juce_LeakedObjectDetector.h:92
*** Leaked objects detected: 2 instance(s) of class StringArray
JUCE Assertion failure in juce_LeakedObjectDetector.h:92

If you use static or global variables, the Juce memory leak detection may not correctly track those because that system itself depends on statics/globals.

The SelectableUpdateTimer at least should be juce::DeletedOnShutdown are you sure you’ve started juce correctly?

You can’t run Tracktion Engine without a full JUCE message loop as it needs the timers etc.

Rail

This is how we start the Framework:

  1. We create a juce::MessageManager by getting it from juce::MessageManager::getInstance()
  2. We create a te::Engine

Is that correct and enough?

We tried running deleteInstance() on the juce::MessageManager at the end of our destructor, but we still get the leaks.

You need to wrap your main function in a ScopedJuceInitialiser_GUI init; like this:

1 Like

Great it works! :slightly_smiling_face:
I notice the “GUI” in the name but I guess it isn’t a problem for a non-GUI app?
Thanks!

Yeah, I think it just sets up everything required for a GUI app.