[mapguide-commits] r10226 - in branches/4.0/MgDev: Oem/LinuxApt Server/src/Core

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Oct 23 11:47:08 PDT 2026


Author: jng
Date: 2026-10-23 11:47:06 -0700 (Fri, 23 Oct 2026)
New Revision: 10226

Modified:
   branches/4.0/MgDev/Oem/LinuxApt/
   branches/4.0/MgDev/Server/src/Core/main.cpp
Log:
Allow mgserver to dump crtdbg memory leak report to stderr if MG_CRT_LEAK_CHECK is set

Index: branches/4.0/MgDev/Oem/LinuxApt
===================================================================
--- branches/4.0/MgDev/Oem/LinuxApt	2026-10-23 11:25:59 UTC (rev 10225)
+++ branches/4.0/MgDev/Oem/LinuxApt	2026-10-23 18:47:06 UTC (rev 10226)

Property changes on: branches/4.0/MgDev/Oem/LinuxApt
___________________________________________________________________
Modified: svn:ignore
## -2,3 +2,4 ##
 httpd-2.4.52
 php-5.6.40
 httpd-2.4.65
+httpd-2.4.69
Modified: branches/4.0/MgDev/Server/src/Core/main.cpp
===================================================================
--- branches/4.0/MgDev/Server/src/Core/main.cpp	2026-10-23 11:25:59 UTC (rev 10225)
+++ branches/4.0/MgDev/Server/src/Core/main.cpp	2026-10-23 18:47:06 UTC (rev 10226)
@@ -58,6 +58,16 @@
 #ifdef _WIN32
     _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
 
+    // The leak report is written to the debugger's output, which a plain
+    // command-line run discards. Set MG_CRT_LEAK_CHECK=1 to send it to stderr
+    // instead, so that it shows up in the run's console output and in the log
+    // file a test run tees to.
+    if (getenv("MG_CRT_LEAK_CHECK") != NULL)
+    {
+        _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
+        _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+    }
+
     #ifdef _DEBUG
     // to debug memory leaks, set a breakpoint here and set iBlock
     // to the block allocation you want to break on



More information about the mapguide-commits mailing list