With a LibGDX Game
I have a Lobby Screen
From the Lobby Screen I can go to
Game 1 Game 2 Game 3 Game 4
When I exit Game 1 (for example) I return back to the Lobby Which allows me now to pick Game 3 (for example)
What I'm noticing is the java native memory is growing
When I do Lobby -> Game 1 -> Lobby -> Game 2 - > Lobby -> Game 3 -> Lobby - > Game 4 …
From Lobby I have
switch (selection) {
case 1: NewStage = new Game1Screen(); break;
case 2: NewStage = new Game2Screen(); break;
case 3: NewStage = new Game3Screen(); break;
case 4: NewStage = new Game4Screen(); break;
}
game.setScreen (NewStage);
This successfully takes me off to the new Game
Now within the Game Screen I have
switch (state) {
case EXITING: this.dispose();
game.setScreen(Lobby); <<-- probably causing the memory growth
break;
}
I don't think this is completely shutting down the level and thus causing Java Native Memory to grow.
I want to shutdown and completely destroy the Game once it has been exited and we are back at the Lobby.