PropertiesFile memory leak?


#1

I’ve been getting memory leaks on my application exist, from the memory deump it looks like the propertiesFile class is leaking memory (or i’m doing something wrong)

in my main component dtor i do

	ApplicationProperties::getInstance()->getUserSettings()->save();
	ApplicationProperties::getInstance()->closeFiles();

i noticed that i don’t need to do deleteInstance() because PropertiesFile is a singleton derived from DeleteAtShutdown

the more options i set the bigger the leak

Detected memory leaks!
Dumping objects ->
c:\devel\juce\src\juce_appframework\application\juce_propertiesfile.h(170) : {1832} normal block at 0x010E19F0, 184 bytes long.
 Data: <X`   l          > 58 60 A4 00 CC 6C A4 00 00 00 00 00 00 00 00 00 
c:\devel\juce\src\juce_core\text\juce_string.cpp(145) : {1831} normal block at 0x010E1938, 122 bytes long.
 Data: <    7   d : \ P > 01 00 00 00 37 00 00 00 64 00 3A 00 5C 00 50 00 
c:\devel\juce\src\juce_core\text\juce_string.h(1048) : {1796} normal block at 0x010E2698, 4 bytes long.
 Data: < "  > E0 22 0E 01 
c:\devel\juce\src\juce_core\text\juce_string.h(1048) : {1794} normal block at 0x010E25F8, 4 bytes long.
 Data: <    > F8 20 0E 01 
{1792} normal block at 0x010E2558, 32 bytes long.
 Data: <     &          > C0 0B 0E 01 98 26 0E 01 CD CD CD CD CD CD CD CD 
c:\devel\juce\src\juce_core\text\juce_string.h(1048) : {1790} normal block at 0x010E0BC0, 4 bytes long.
 Data: <    > 20 1D 0E 01 
{1788} normal block at 0x010E2440, 32 bytes long.
 Data: <     %          > A0 F9 0D 01 F8 25 0E 01 CD CD CD CD CD CD CD CD 
c:\devel\juce\src\juce_core\text\juce_string.h(1048) : {1786} normal block at 0x010DF9A0, 4 bytes long.
 Data: <    > B0 15 0E 01 
c:\devel\juce\src\juce_core\text\juce_string.cpp(104) : {1783} normal block at 0x010E22E0, 42 bytes long.
 Data: <        7 8 5   > 01 00 00 00 0F 00 00 00 37 00 38 00 35 00 20 00 
c:\devel\juce\src\juce_core\text\juce_string.cpp(104) : {1777} normal block at 0x010E20F8, 30 bytes long.
 Data: <        r e c t > 01 00 00 00 09 00 00 00 72 00 65 00 63 00 74 00 
c:\devel\juce\src\juce_core\text\juce_string.cpp(104) : {1766} normal block at 0x010E1D20, 62 bytes long.
 Data: <        h t t p > 01 00 00 00 19 00 00 00 68 00 74 00 74 00 70 00 
c:\devel\juce\src\juce_core\text\juce_string.cpp(104) : {1760} normal block at 0x010E15B0, 36 bytes long.
 Data: <        e d o U > 01 00 00 00 0C 00 00 00 65 00 64 00 6F 00 55 00 
c:\devel\juce\src\juce_appframework\application\juce_propertiesfile.h(170) : {1718} normal block at 0x010E1370, 184 bytes long.
 Data: <X`   l  @$      > 58 60 A4 00 CC 6C A4 00 40 24 0E 01 08 00 00 00 
c:\devel\juce\src\juce_core\text\juce_string.cpp(145) : {1713} normal block at 0x010E1710, 120 bytes long.
 Data: <    6   d : \ P > 01 00 00 00 36 00 00 00 64 00 3A 00 5C 00 50 00 
Object dump complete.

#2

Well you clearly do need to delete it!

One thing to check: the singleton gets deleted at shutdown, but after it’s deleted, maybe some of your own shutdown code does another getInstance on it and creates a new one.

Just stick breakpoints in its constructor and destructor. Should be trivial to see what’s going on.


#3

you are right (as always), this was a win32 global hotkey thread accessing the keycode, after all components have been deleted, once i again thank you very much, i’m not worthy :slight_smile: