Possible memory leak


#1

Hi all,

In juce.h shouldnt below code1 be replaced code2 to prevent a memory leak.

--------------------------code1-----------------------------:frowning:
#define START_JUCE_APPLICATION(AppClass)
int main (int argc, char* argv[])
{
JUCEApplication::main (argc, argv, new AppClass());
return 0;
}
--------------------------code1-----------------------------:slight_smile:

--------------------------code2-----------------------------
#define START_JUCE_APPLICATION(AppClass)
int main (int argc, char* argv[])
{
AppClass * app = new AppClass();
JUCEApplication::main (argc, argv, app);
delete app;
return 0;
}

--------------------------code2-----------------------------


#2

It’s deleted in JUCEApplication::shutdownAppAndClearUp.

  • kbj

#3

…no, the app object gets deleted by JUCEApplication::shutdownAppAndClearUp()


#4