addToDesktop(0,parent) memory leak


#1

Hello,

I’m creating a JUCE GUI from a DLL and add it to the host application using

in the destruktor I call

but visual studio is reporting a memory leak

etected memory leaks! Dumping objects -> {329} normal block at 0x019F85D8, 36 bytes long. Data: < > A8 98 83 10 01 00 00 00 00 00 00 00 00 00 00 00 Object dump complete.

as soon as I remove the

call the memory leak is gone.

Am I missing something?

comboy


#2

There’s certainly no leak in that method when it’s used normally.

But if you’ve hacked it together so that you’re sharing objects between DLLs and a host, then you’re on your own with any memory management problems you create, I’m afraid.


#3

but isn’t this exactly what you’re doing in the “juce_VST_Wrapper.cpp”?

comboy


#4

It might be similar, but that doesn’t mean I can magically tell you why your code is leaking!

TBH that size of object is probably just a message getting left behind on the message queue when you unload the app.


#5

[quote=“jules”]It might be similar, but that doesn’t mean I can magically tell you why your code is leaking!
[/quote]

I didn’t expect you to magically know where my problem is. Sorry if it sounded like that!
Just thought since you wrote the vst wrapper maybe you had an idea why the memory COULD be leaking in this usecase.

I solved the leak. The problem was the point where I called the shutdownJuce_GUI(); function.
First I had it inside my PluginEditor Class and it was called whenever the editor was closed in its destructor.

Now I moved the call to my base plugin class, so it is only called when the plugin is destroyed and the leak is gone.
Not sure why, because only the pluginEditor class is using juce functions but at least the leak is gone :slight_smile:

comboy