Problem of memory leaks


#1

Hi,

I'm using Juce modules 3.0.2, with visual studio 2013 on windows7.

I experienced recently some memory leaks detections from Visual Studio.

When I execute my program in debug mode and when it stops, visual studio reports some memory leaks.

Since many days I tried to bypass many part of my code to try to identify what part could generate it, without success.

At the same time my code is very simple and I really dont see what could make such events happen.

 

So, I tried something else. I ran JuceDemo in debug mode, inside visual studio 2013.

1) I run JuceDemo and I close it. -> No memory leaks.

2) I run JuceDemo, I click on "tabs and widgets" then I close it, here is what I get:


'JuceDemo.exe' (Win32) : Déchargé 'C:\Windows\System32\d3d10warp.dll'
'JuceDemo.exe' (Win32) : Déchargé 'C:\Windows\System32\DWrite.dll'
'JuceDemo.exe' (Win32) : Déchargé 'C:\Windows\System32\d2d1.dll'
'JuceDemo.exe' (Win32) : Déchargé 'C:\Windows\System32\d3d11.dll'
'JuceDemo.exe' (Win32) : Déchargé 'C:\Windows\System32\dxgi.dll'
Detected memory leaks!
Dumping objects ->
{92771} normal block at 0x00000000068A2840, 35 bytes long.
 Data: <                > 00 00 00 00 CD CD CD CD 0C 00 00 00 00 00 00 00 
{92770} normal block at 0x00000000068A27C0, 16 bytes long.
 Data: <P(        IB    > 50 28 8A 06 00 00 00 00 10 0D 49 42 08 00 00 00 
{92761} normal block at 0x00000000068A24E0, 27 bytes long.
 Data: <                > 00 00 00 00 CD CD CD CD 04 00 00 00 00 00 00 00 
{92760} normal block at 0x00000000068A2460, 16 bytes long.
 Data: < $      4  A    > F0 24 8A 06 00 00 00 00 34 E3 A7 41 03 00 00 00 
{92756} normal block at 0x00000000068A23E0, 27 bytes long.
 Data: <                > 00 00 00 00 CD CD CD CD 04 00 00 00 00 00 00 00 
{92755} normal block at 0x00000000068A2360, 16 bytes long.
 Data: < #         @    > F0 23 8A 06 00 00 00 00 1F 98 81 40 01 00 00 00 
{92751} normal block at 0x00000000068A22D0, 31 bytes long.
 Data: <                > 00 00 00 00 CD CD CD CD 08 00 00 00 00 00 00 00 
{92750} normal block at 0x00000000068A2250, 16 bytes long.
 Data: < "         A    > E0 22 8A 06 00 00 00 00 D7 0F B6 41 04 00 00 00 
{92746} normal block at 0x00000000068A21D0, 27 bytes long.
 Data: <                > 00 00 00 00 CD CD CD CD 04 00 00 00 00 00 00 00 
{92745} normal block at 0x00000000068A2150, 16 bytes long.
 Data: < !         @    > E0 21 8A 06 00 00 00 00 1F 98 81 40 01 00 00 00 
{92740} normal block at 0x00000000068A2010, 35 bytes long.
 Data: <                > 00 00 00 00 CD CD CD CD 0C 00 00 00 00 00 00 00 
{92739} normal block at 0x00000000068A1F90, 16 bytes long.
 Data: <          tB    > 20 20 8A 06 00 00 00 00 91 EC 74 42 0B 00 00 00 
Object dump complete.
Le thread 0x1d7c s'est arrêté avec le code 0 (0x0).
Le thread 0x1338 s'est arrêté avec le code 0 (0x0).
Le programme '[0x1F88] JuceDemo.exe' s'est arrêté avec le code 0 (0x0).

I tried making the file name and the line appear with _CRTDBG_MAP_ALLOC but it's a nightmare to get it works,

I nevery succeded. I tried to put some _CrtSetBreakAlloc(...) for it stops when the object is allocated, but I get some breakpoints

inside JUCE modules, I can't explain. For example the _CrtSetBreakAlloc(...) generates a breakpoint on 

 

JUCEApplication::getInstance()->quit();

 

It would mean the object is allocated by this statement.

Of course I could ignore these memory leaks, as my program seems doing what it's supposed to do, but I don't feel so safe.

 


#2

No such leaks for me when I run the demo.. (?)


#3

It happens when I use the following options of the demo:


System Info
Tabs & Widgets
Live Constant -> click on Begin Demo
MDI
Transforms
Web Browser
Fonts
Settings
Latency Detector
Cryptography
HTTP
Javascript
Unit Tests

It occurs when I run it in debug mode, and it's compiled in 64bits mode, but I tried in 32bits mode, I get the same problem.

 


#4

It could just be a couple of undelivered messages on the message queue that didn't arrive before the app shutdown, but I really don't know, and like I said, I can't reproduce it..


#5

Thanks.

So I just downloaded the last Juce modules. (My previous version was downloaded about 2 weeks before)

And now Juce Demo never issue any memory leaks after quit.

Though my program still does. Maybe it's because I call JUCEApplication::getInstance()->quit() inside the initialise method

of my application, I'll try to dig.