From 642e33130920dfd96735b92c5467771087099f6c Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Mon, 18 Aug 2003 22:31:29 +0000 Subject: [PATCH] Improve tracking --- main/main.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/main/main.c b/main/main.c index 8131a891d5..ac25719838 100644 --- a/main/main.c +++ b/main/main.c @@ -867,10 +867,10 @@ static void php_message_handler_for_zend(long message, void *data) break; case ZMSG_MEMORY_LEAK_DETECTED: case ZMSG_MEMORY_LEAK_REPEATED: { +#if ZEND_DEBUG TSRMLS_FETCH(); if ((EG(error_reporting)&E_WARNING) && PG(report_memleaks)) { -#if ZEND_DEBUG char memory_leak_buf[512]; if (message==ZMSG_MEMORY_LEAK_DETECTED) { @@ -894,9 +894,26 @@ static void php_message_handler_for_zend(long message, void *data) # else fprintf(stderr, "%s", memory_leak_buf); # endif + } + } #endif + break; + case ZMSG_MEMORY_LEAKS_GRAND_TOTAL: { +#if ZEND_DEBUG + TSRMLS_FETCH(); + + if ((EG(error_reporting)&E_WARNING) && PG(report_memleaks)) { + char memory_leak_buf[512]; + + snprintf(memory_leak_buf, 512, "=== Total %d memory leaks detected ===\n", *((zend_uint *) data)); +# if defined(PHP_WIN32) + OutputDebugString(memory_leak_buf); +# else + fprintf(stderr, "%s", memory_leak_buf); +# endif } } +#endif break; case ZMSG_LOG_SCRIPT_NAME: { struct tm *ta, tmbuf; -- 2.40.0