Browse Source

Save 1.3 MiB RAM in-game by freeing menu resources

Running with a memory profiler revealed that we were keeping main menu
UI resources around while the game was running.
pull/1280/head
Gleb Mazovetskiy 5 years ago committed by Anders Jenbo
parent
commit
9dd91d1c2c
  1. 9
      Source/diablo.cpp

9
Source/diablo.cpp

@ -377,6 +377,10 @@ BOOL StartGame(BOOL bNewGame, BOOL bSinglePlayer)
break;
}
// Save 1.3 MiB of RAM by freeing all main menu resources
// before starting the game.
UiDestroy();
gbSelectProvider = FALSE;
if (bNewGame || !gbValidSaveFile) {
@ -392,6 +396,11 @@ BOOL StartGame(BOOL bNewGame, BOOL bSinglePlayer)
run_game_loop(uMsg);
NetClose();
pfile_create_player_description(NULL, 0);
// If the player left the game into the main menu,
// initialize main menu resources.
if (gbRunGameResult)
UiInitialize();
} while (gbRunGameResult);
SNetDestroy();

Loading…
Cancel
Save