diff --git a/win32/DumpAtEnd.cpp b/win32/DumpAtEnd.cpp new file mode 100644 index 00000000..9a8ba699 --- /dev/null +++ b/win32/DumpAtEnd.cpp @@ -0,0 +1,17 @@ +// uncomment to find memory leaks at end +// #define CHECK_MEMORY_LEAKS + +// to also display file locations in some cases define _CRTDBG_MAP_ALLOC in the project properties + +#ifdef CHECK_MEMORY_LEAKS +// hack to make sure this object is destructed last +// msvc merges .CRT$XC in alphabetic order +// might not work in other versions of MSVC +#pragma init_seg(".CRT$XCB") +struct CallDumpMemLeaksLast { + ~CallDumpMemLeaksLast() { + _CrtDumpMemoryLeaks(); + } +}; +static CallDumpMemLeaksLast dump_last; +#endif \ No newline at end of file diff --git a/win32/snes9xw.vcxproj b/win32/snes9xw.vcxproj index fe395fca..731c2f43 100644 --- a/win32/snes9xw.vcxproj +++ b/win32/snes9xw.vcxproj @@ -534,6 +534,7 @@ + diff --git a/win32/snes9xw.vcxproj.filters b/win32/snes9xw.vcxproj.filters index 454ddcd8..f2a1e4f9 100644 --- a/win32/snes9xw.vcxproj.filters +++ b/win32/snes9xw.vcxproj.filters @@ -539,6 +539,9 @@ APU + + GUI + diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index c67b5fc7..ebc4790a 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -244,13 +244,6 @@ #include "wlanguage.h" #include "../language.h" -//uncomment to find memory leaks, with a line in WinMain -//#define CHECK_MEMORY_LEAKS - -#ifdef CHECK_MEMORY_LEAKS - #include -#endif - #include #include #include