|
@@ -258,13 +258,30 @@ void Game::resume()
|
|
|
|
|
|
|
|
void Game::exit()
|
|
void Game::exit()
|
|
|
{
|
|
{
|
|
|
- // Schedule a call to shutdown rather than calling it right away.
|
|
|
|
|
|
|
+ // Only perform a full/clean shutdown if FORCE_CLEAN_SHUTDOWN or
|
|
|
|
|
+ // GAMEPLAY_MEM_LEAK_DETECTION is defined. Every modern OS is able to
|
|
|
|
|
+ // handle reclaiming process memory hundreds of times faster than it
|
|
|
|
|
+ // would take us to go through every pointer in the engine and release
|
|
|
|
|
+ // them nicely. For large games, shutdown can end up taking long time,
|
|
|
|
|
+ // so we'll just call ::exit(0) to force an instant shutdown.
|
|
|
|
|
+
|
|
|
|
|
+#if defined FORCE_CLEAN_SHUTDOWN || defined GAMEPLAY_MEM_LEAK_DETECTION
|
|
|
|
|
+
|
|
|
|
|
+ // Schedule a call to shutdown rather than calling it right away.
|
|
|
// This handles the case of shutting down the script system from
|
|
// This handles the case of shutting down the script system from
|
|
|
// within a script function (which can cause errors).
|
|
// within a script function (which can cause errors).
|
|
|
static ShutdownListener listener;
|
|
static ShutdownListener listener;
|
|
|
schedule(0, &listener);
|
|
schedule(0, &listener);
|
|
|
|
|
+
|
|
|
|
|
+#else
|
|
|
|
|
+
|
|
|
|
|
+ // End the process immediately without a full shutdown
|
|
|
|
|
+ ::exit(0);
|
|
|
|
|
+
|
|
|
|
|
+#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
void Game::frame()
|
|
void Game::frame()
|
|
|
{
|
|
{
|
|
|
if (!_initialized)
|
|
if (!_initialized)
|