From 136a2cd05a14db445545bc6bd78e885ecbc251d6 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 14 Jul 2012 03:56:56 +0000 Subject: [PATCH] - Since the scripting branch relies heavily on the garbage collector to clean up everything, move the final GC back to after the type system has been shut down. SVN r3760 (scripting) --- src/d_main.cpp | 33 +++++++++++++++++---------------- src/dobject.cpp | 2 +- src/win32/i_main.cpp | 2 +- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 603e66842..ee46a894d 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1805,6 +1805,22 @@ static void SetMapxxFlag() if (lump_name >= 0 || lump_wad >= 0 || lump_map >= 0) gameinfo.flags |= GI_MAPxx; } +//========================================================================== +// +// FinalGC +// +// If this doesn't free everything, the debug CRT will let us know. +// +//========================================================================== + +static void FinalGC() +{ + Args = NULL; + GC::FinalGC = true; + GC::FullGC(); + GC::DelSoftRootHead(); // the soft root head will not be collected by a GC so we have to do it explicitly +} + //========================================================================== // // Initialize @@ -1833,6 +1849,7 @@ static void D_DoomInit() // Check response files before coalescing file parameters. M_FindResponseFile (); + atterm(FinalGC); PClass::StaticInit(); PType::StaticInit(); @@ -2059,21 +2076,6 @@ static void CheckCmdLine() } } -//========================================================================== -// -// FinalGC -// -// If this doesn't free everything, the debug CRT will let us know. -// -//========================================================================== - -static void FinalGC() -{ - Args = NULL; - GC::FullGC(); - GC::DelSoftRootHead(); // the soft root head will not be collected by a GC so we have to do it explicitly -} - //========================================================================== // // D_DoomMain @@ -2091,7 +2093,6 @@ void D_DoomMain (void) int argcount; D_DoomInit(); - atterm(FinalGC); // [RH] Make sure zdoom.pk3 is always loaded, // as it contains magic stuff we need. diff --git a/src/dobject.cpp b/src/dobject.cpp index d36e1baf4..8e209e640 100644 --- a/src/dobject.cpp +++ b/src/dobject.cpp @@ -257,7 +257,7 @@ DObject::DObject (PClass *inClass) DObject::~DObject () { - if (!(ObjectFlags & OF_Cleanup)) + if (!(ObjectFlags & OF_Cleanup) && !PClass::bShutdown) { DObject **probe; PClass *type = GetClass(); diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index 4079fcae7..2369d4bde 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -1285,7 +1285,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n _CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF); // Use this to break at a specific allocation number. - //_crtBreakAlloc = 77624; + //_crtBreakAlloc = 18800; #endif DoMain (hInstance);