Restart application

Hi, I've read about cleaning up and restart on the forum, but with my clean up:


       display.getRenderer().cleanup();
   //   TextureManager.doTextureCleanup();
        TextureManager.clearCache();
      //  KeyInput.destroyIfInitalized();
        GameStateManager.getInstance().cleanup();
        scene.detachAllChildren();
        DisplaySystem.getDisplaySystem().getCurrentContext().invalidateStates();
        AudioSystem.getSystem().cleanup();



it takes about 40-50seconds and even more to restart the main menu. On the first start it takes maximum 3-5seconds.
So can I, in some way, close the whole process and restart the whole game automatically?...or there's a more efficient cleaning?

p.s.: I use a FixedFramerateGame, and before the cleanup() I disconnect all server/clients.

thanks  :wink:

<edit>
"scene" is the rootNode
</edit>

What is it that's taking so long in your cleanup?

well… some time ago i had a problem with every consequent launch being slower and slower and it turned out that after some error, 1 thread just remained running, although i had thought i had exited the app… dont remember exactly how i managed to pull that one off 

Profile that method and see what takes the longest time.

I've solved making a simple class that manage start() and finish() of my StandardGame, and now it goes fast!

thanks… :wink: